I put your test code in a test.py within a vscode devcontainer (docker based), added my user credentials (hydrawise account username/password -> no token!) and run test.py.
My zone[0] started correctly (zone[0] is the first configured zone on my Pro-HC), but threw some errors corresponding to wrong credentials.
vscode โ ~/pydrawise (main) $ /usr/local/python/current/bin/python /home/vscode/pydrawise/test.py
Traceback (most recent call last):
File "/home/vscode/pydrawise/test.py", line 21, in
asyncio.run(main())
File "/usr/local/python/3.11.4/lib/python3.11/asyncio/runners.py", line 190, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "/usr/local/python/3.11.4/lib/python3.11/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/python/3.11.4/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "/home/vscode/pydrawise/test.py", line 11, in main
controllers = await h.get_controllers()
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/pydrawise/pydrawise/client.py", line 96, in get_controllers
result = await self._query(selector)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/pydrawise/pydrawise/client.py", line 62, in _query
async with await self._client() as session:
^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/pydrawise/pydrawise/client.py", line 57, in _client
headers = {"Authorization": await self._auth.token()}
^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/pydrawise/pydrawise/auth.py", line 80, in token
await self.check_token()
File "/home/vscode/pydrawise/pydrawise/auth.py", line 71, in check_token
await self._fetch_token_locked(refresh=False)
File "/home/vscode/pydrawise/pydrawise/auth.py", line 59, in _fetch_token_locked
raise NotAuthorizedError(resp_json["message"])
pydrawise.exceptions.NotAuthorizedError: The user credentials were incorrect.