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

Fix error handling for authentication and no longer use session for retries #141

Closed pnbruckner closed 4 years ago

pnbruckner commented 4 years ago

_generate_token() only caught CommError's if they happened while trying Basic Authentication. Now it will catch them while trying Digest Authentication.

Clear auth token for any LoginError.

_command() was using a Session() for retry attempts. Don't do this anymore to make it more likely for retry to succeed. Also, for some as of yet unexplained reason using request.get() instead of session.get() seems to prevent intermittent snapshot failures.

coveralls commented 4 years ago

Coverage Status

Coverage increased (+0.002%) to 31.641% when pulling 9e0c89c206d1007a2268a3f31601bda2d80b0379 on fix-http-command into fdbb775be57f650d47801a2a3008125e979223b1 on master.