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
213 stars 76 forks source link

Add async APIs throughout #193

Closed flacjacket closed 2 years ago

flacjacket commented 2 years ago

Add a full suite of API functions that are able to use asyncio-based calls. The async http requests are provided through httpx, which is able to provide both basic auth and digest auth through its async client. Using the async functions and the new async keywords requires removing Python 3.6 support. In particular, this allows us to use async and await keywoards. Setting up the async APIs unfortunately requires a rough doubling of the API to add both sync and async code to get functions of the appropriate color. Where there is a reasonable amount of non-I/O logic, this is refactored out into common functions.