JSON parsing bug
Having a pylogbook client pointing to pylogbook.NamedServer.TEST
, activities is set to []
.
Not having passed an RBAC token, and calling pylogbook.Client.get_events(from_date=start_date)
produces JSON parsing error:
Traceback (most recent call last):
events_pages = self._client.get_events(from_date=start_date)
File "/opt/acc-py/2020.11/lib/python3.7/site-packages/pylogbook/_client.py", line 193, in get_events
events = PaginatedEvents(resp.json()['answerAsCount'], query)
File "/opt/acc-py/2020.11/lib/python3.7/site-packages/requests/models.py", line 900, in json
return complexjson.loads(self.text, **kwargs)
File "/acc/local/share/python/acc-py/base/2020.11/lib/python3.7/json/__init__.py", line 348, in loads
return _default_decoder.decode(s)
File "/acc/local/share/python/acc-py/base/2020.11/lib/python3.7/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/acc/local/share/python/acc-py/base/2020.11/lib/python3.7/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)
pylogbook v3.1.0
Expectations:
- If the issue is with Authentication,
LogbookError
should be produced. - If the issue is with empty activities, JSON parsing should be able to handle it or another
LogbookError
produced stating the invalid request.
Edited by Ivan Sinkarenko