tchellomello / python-amcrest

A Python 2.7/3.x module for Amcrest and Dahua Cameras using the SDK HTTP API.
GNU General Public License v2.0
216 stars 76 forks source link

Use unique amcrest exceptions #108

Closed pnbruckner closed 5 years ago

pnbruckner commented 5 years ago

Use amcrest specific exceptions where appropriate, such as for communication and login errors. Use retries and timeouts when generating authentation object. Check for invalid login when using Basic Authentication.

coveralls commented 5 years ago

Coverage Status

Coverage increased (+0.1%) to 33.333% when pulling 44589697adf5b569c47331955c3ae603a075f223 on exceptions into 31d616bc943d780cbe26c3f32d62b68d8a4e51e9 on master.

coveralls commented 5 years ago

Coverage Status

Coverage increased (+0.3%) to 33.485% when pulling b5f2f4f0d30f46892840c2a209f895419c2b3855 on exceptions into 31d616bc943d780cbe26c3f32d62b68d8a4e51e9 on master.

pnbruckner commented 5 years ago

One change I'm not absolutely sure about. I noticed in Http._generate_token that the response from the camera was only checked for "invalid" and "error" if Digest Authentication was used. Specifically, it did not do this test if Basic Authentication was used. I suspected this was an oversight, so I changed it to do the test no matter which authentication type was used. Is that correct? Or did it only do that check if Digest Authentication was used on purpose?

pnbruckner commented 5 years ago

Also, although these changes technically constitute an API change, it may not be worth going to version 2.0.0. 1.2.6 should be fine. Once these changes are released on pypi.org as a new version I'll update the HA amcrest components accordingly.