Usage
from hikconnect.api import HikConnect
async with HikConnect() as api:
await api.login("foo", "bar")
devices = [device async for device in api.get_devices()]
print(devices)
my_device_serial = devices[0]["serial"]
cameras = [camera async for camera in api.get_cameras(my_device_serial)]
print(cameras)
call_status = await api.get_call_status(my_device_serial)
print(call_status)
await api.unlock(my_device_serial, 1)
await api.cancel_call(my_device_serial)
if api.is_refresh_login_needed():
await api.refresh_login()
If you are new to async
Python, you simply need to wrap your code in a construction like this:
import asyncio
async def main():
asyncio.run(main())
More info in the async
docs.