shenxn / libdyson

Python library for dyson devices
Apache License 2.0
62 stars 41 forks source link

Endpoint not available error #7

Closed jarocks closed 3 years ago

jarocks commented 3 years ago

For some reason, the endpoint doesn't seem to be available right now and Dyson for some reason decided to return malformed JSON {error: "Endpoint is not available currently"}

Which then causes this error at libdyson/cloud/account.py:162 json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1)

It seems to throw a 429 error when this is the case so that can probably be used to help prevent this issue.

In home assistant this manifests as a Unknown Error

shenxn commented 3 years ago

Since OTP too frequent also uses status code 429, it may not be a good idea to consider status code 429 as server error. There is nothing I can do here since even the lib can parse that malformed JSON, it can only raise another error, which I think does not help much.