tonyseek / openvpn-status

Parse OpenVPN status logs in Python
https://openvpn-status.readthedocs.io
MIT License
83 stars 31 forks source link

KeyError #12

Closed tunelko closed 5 years ago

tunelko commented 5 years ago

Hi, With your own example, keyerror on retrieving status.client_list["foo@example.com"]

Debugging on pdb `--Return--

/usr/local/lib/python3.5/dist-packages/openvpn_status/descriptors.py(19)get()->OrderedDict([...6d9e2d77f0>)]) -> return instance.dict[self.name] (Pdb) KeyError: 'foo@example.com' ` But if i try to set "Real Address" field, it works in your example.

I'll continue trying to catch the error and post here. Could you review ? Thanks.

tonyseek commented 5 years ago

Hi @tunelko,

It is a breaking change in 0.2.0. The status.client_list is indexed by the client.real_address instead of client.common_name because common_name is not unique while multiple sessions on the same user (https://github.com/tonyseek/openvpn-status/issues/2 https://github.com/tonyseek/openvpn-status/pull/5).

The document and README file is staled. I will update them soon.

Thank you for your feedback!