Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle None JWT response #26

Open
TomBrien opened this issue Mar 9, 2022 · 0 comments
Open

Handle None JWT response #26

TomBrien opened this issue Mar 9, 2022 · 0 comments

Comments

@TomBrien
Copy link
Owner

TomBrien commented Mar 9, 2022

2022-03-09 13:08:40 DEBUG (SyncWorker_1) [cardiffwaste.cardiffwaste] Starting sorting bins
2022-03-09 13:08:40 DEBUG (SyncWorker_1) [cardiffwaste.cardiffwaste] Requesting JWT
2022-03-09 13:08:40 DEBUG (SyncWorker_1) [cardiffwaste.cardiffwaste] Completed JWT request with status code: 200
2022-03-09 13:08:40 ERROR (MainThread) [custom_components.cardiffwaste] Unexpected error fetching cardiffwaste data: Expecting value: line 1 column 1 (char 0)
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 187, in _async_refresh
self.data = await self._async_update_data()
File "/config/custom_components/cardiffwaste/__init__.py", line 111, in _async_update_data
return await self._hass.async_add_executor_job(
File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/local/lib/python3.9/site-packages/cardiffwaste/cardiffwaste.py", line 201, in get_next_collections
response = self.get_raw_collections()
File "/usr/local/lib/python3.9/site-packages/cardiffwaste/cardiffwaste.py", line 145, in get_raw_collections
jwt = _get_token(self._user_agent)
File "/usr/local/lib/python3.9/site-packages/cardiffwaste/cardiffwaste.py", line 50, in _get_token
result = json.loads(xml.find("GetJWTResult").get_text())
File "/usr/local/lib/python3.9/json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "/usr/local/lib/python3.9/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/local/lib/python3.9/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)
2022-03-09 13:08:40 DEBUG (MainThread) [custom_components.cardiffwaste] Finished fetching cardiffwaste data in 0.274 seconds (success: False)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant