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

Error when handling failed geo request #374

Open
xevg opened this issue Aug 1, 2023 · 1 comment
Open

Error when handling failed geo request #374

xevg opened this issue Aug 1, 2023 · 1 comment

Comments

@xevg
Copy link

xevg commented Aug 1, 2023

  • Hyundai / Kia Connect version:
  • Python version: 3.9
  • Operating System: MacOS

Description

Openstreetmap seems to be having an issue with one of their servers, which is causing an issues. The response to the request is this:

<html>\r\n<head><title>502 Bad Gateway</title></head>\r\n<body>\r\n<center><h1>502 Bad Gateway</h1></center>\r\n<hr><center>nginx</center>\r\n</body>\r\n</html>\r\n

When the code tries to process it, it fails with an exception while handling an exception, and the process dies.

Traceback (most recent call last):
File "/Users/xev/opt/anaconda3/lib/python3.9/site-packages/requests/models.py", line 971, in json
return complexjson.loads(self.text, **kwargs)
File "/Users/xev/opt/anaconda3/lib/python3.9/json/init.py", line 346, in loads
return _default_decoder.decode(s)
File "/Users/xev/opt/anaconda3/lib/python3.9/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/Users/xev/opt/anaconda3/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)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/xev/opt/anaconda3/lib/python3.9/site-packages/click/core.py", line 1053, in main
rv = self.invoke(ctx)
File "/Users/xev/opt/anaconda3/lib/python3.9/site-packages/click/core.py", line 1659, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/Users/xev/opt/anaconda3/lib/python3.9/site-packages/click/core.py", line 1395, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Users/xev/opt/anaconda3/lib/python3.9/site-packages/click/core.py", line 754, in invoke
return __callback(*args, **kwargs)
File "/Users/xev/opt/anaconda3/lib/python3.9/site-packages/click/decorators.py", line 26, in new_func
return f(get_current_context(), *args, **kwargs)
File "/Users/xev/Library/CloudStorage/Dropbox/PyProjects/hyundai/hyundai.py", line 91, in collect
vm.update_all_vehicles_with_cached_state()
File "/Users/xev/opt/anaconda3/lib/python3.9/site-packages/hyundai_kia_connect_api/VehicleManager.py", line 75, in update_all_vehicles_with_cached_state
self.update_vehicle_with_cached_state(vehicle_id)
File "/Users/xev/opt/anaconda3/lib/python3.9/site-packages/hyundai_kia_connect_api/VehicleManager.py", line 82, in update_vehicle_with_cached_state
self.api.update_geocoded_location(
File "/Users/xev/opt/anaconda3/lib/python3.9/site-packages/hyundai_kia_connect_api/ApiImpl.py", line 89, in update_geocoded_location
response = response.json()
File "/Users/xev/opt/anaconda3/lib/python3.9/site-packages/requests/models.py", line 975, in json
raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
python-BaseException

What I Did

Paste the command(s) you ran and the output.
If there was a crash, please include the traceback here.
@cdnninja
Copy link
Collaborator

Maybe I'm reading this wrong. My impression is whatever code you are calling this with didn't like it didn't have a response from the API. How is your error handling setup in the calling code?

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

2 participants