json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) Error
Hi
Since HomeAssistant updated to the newest version, I always get the error:
Traceback (most recent call last):
File ".\test.py", line 8, in <module>
favs = device.favorites()
File "C:\Users\rbaer\Desktop\Neuer Ordner\doorbird-test\lib\site-packages\doorbirdpy\__init__.py", line 206, in favorites
return self.__request(self.__url("favorites.cgi", auth=False))
File "C:\Users\rbaer\Desktop\Neuer Ordner\doorbird-test\lib\site-packages\doorbirdpy\__init__.py", line 300, in __request
body_data = json.loads(body_json)
File "C:\Program Files (x86)\Python37-32\lib\json\__init__.py", line 348, in loads
return _default_decoder.decode(s)
File "C:\Program Files (x86)\Python37-32\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Program Files (x86)\Python37-32\lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
To figure out if it is a problem with HASS or your library, I did a small test containing the following code:
from doorbirdpy import DoorBird
from pprint import pprint
device = DoorBird("ip", "usr", "pw")
status = device.ready()
pprint(status)
favs = device.favorites()
and I get the same exception on the last line.
I added some debug points and found out that the variable content in the __request method is empty in some cases (b''). I suspect tha json is not able to parse that empty value as it probably expects an empty json ({}). Any idea why this happens and if you can fix this?
Thanks
Roman
Edited by Roman