finish06 / pyunifi

https://unifi-sdn.ubnt.com/
MIT License
223 stars 99 forks source link

Increase ls-clients reliability #39

Closed hamiltont closed 5 years ago

hamiltont commented 5 years ago

In multiple cases the keys we are looking for will not exist. For example, wired clients will not have AP, channel, or RSSI values. Pending associations are not guaranteed to have all three of these fields added atomically.

One fix would be to hide these types of errors by building a nice 'Client' class and then programming the scripts to a stable, guaranteed interface. An effective stopgap is to do what I'm going with in this commit - to just use .get with some sane default instead of allowing a KeyError exception to happen when the keys do not exist

finish06 commented 5 years ago

Thank you!