Kane610 / aiounifi

Asynchronous library to communicate with Unifi Controller
MIT License
57 stars 49 forks source link

unawaited response text #671

Closed akshaya-a closed 2 weeks ago

akshaya-a commented 1 month ago

Took a quick skim at the codebase and issues but didn't see an obvious culprit to throw up a PR, so writing this down:

Warning in logs:

/usr/local/lib/python3.12/site-packages/aiounifi/interfaces/messages.py:60: RuntimeWarning: coroutine 'ClientResponse.text' was never awaited self.handler(orjson.loads(raw_bytes))
<string>:2: RuntimeWarning: coroutine 'ClientResponse.text' was never awaited
/usr/local/lib/python3.12/site-packages/aiounifi/models/message.py:91: RuntimeWarning: coroutine 'ClientResponse.text' was never awaited @classmethod
/usr/local/lib/python3.12/site-packages/aiounifi/interfaces/messages.py:84: RuntimeWarning: coroutine 'ClientResponse.text' was never awaited continue
/usr/local/lib/python3.12/site-packages/aiounifi/models/api.py:90: RuntimeWarning: coroutine 'ClientResponse.text' was never awaited def __init__(self, raw: Any) -> None:

This is on latest HA, and the error looks like not a Unifi problem, but just in case UniFi OS 3.2.12 Network 8.1.127

akshaya-a commented 1 month ago

if you'll allow some speculation, maybe the log statement? https://github.com/Kane610/aiounifi/blob/469aabdc478009a48352d8259d2f463598836bff/aiounifi/interfaces/connectivity.py#L134

Kane610 commented 1 month ago

Thanks for reporting

The library does not even use ClientResponse.text, it only uses ClientResponse.read

Does it happen often?