Hyundai-Kia-Connect / hyundai_kia_connect_api

This is a Kia UVO and Hyundai Bluelink written in python. It is primary consumed by home assistant. If you are looking for a home assistant Kia / Hyundai implementation please look here: https://github.com/Hyundai-Kia-Connect/kia_uvo. Much of this base code came from reading bluelinky and contributions to the kia_uvo home assistant project.
MIT License
129 stars 73 forks source link

Error when handling failed geo request #374

Open xevg opened 1 year ago

xevg commented 1 year ago

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 commented 10 months ago

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?