Closed DB-CL closed 7 years ago
Thanks for notifying this!
I think the issue is on the IF
series starting here: https://github.com/csparpa/pyowm/blob/master/pyowm/commons/weather_client.py#L58 because it's missing an ELSE
statement
I will anyway add extra checks on the entity parser classes before they get to load the dict from the input JSON string, so to raise an exception whenever that input string is None
Hi there !
I'm using home assistant, a project using pyowm and I was reporting a bug in this project but they told me I should report here (https://github.com/home-assistant/home-assistant/issues/7512).
Something goes wrong when the API call fail for some reason.
Here is the traceback I got from home assistant. The error comes from pyowm files :
I looked a little bit into it and this is effectively wrong : a call to JSON.load() is done on a NoneType object, which leads to a crash : https://github.com/csparpa/pyowm/blob/master/pyowm/webapi25/observationparser.py#L39
The call comes from this line : https://github.com/csparpa/pyowm/blob/master/pyowm/webapi25/owm25.py#L248 and the method producing the None object is there https://github.com/csparpa/pyowm/blob/master/pyowm/commons/weather_client.py#L71
According to the documentation this method should return a string, and it's returning None in some cases.
I think a check is missing in _lookup_cache_or_invoke_API of the same file.