Skip to content

Commit

Permalink
Update OWM wrapper to add backwards-compat error keys
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel McKnight committed May 6, 2024
1 parent 7ab8513 commit 054de9b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions neon_api_proxy/client/open_weather_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ def _make_api_call(lat: Union[str, float], lng: Union[str, float],
except JSONDecodeError:
data = {"error": "Error decoding response",
"response": resp}
if data.get('cod') == "400":
# Backwards-compat. Put error response under `error` key
data["error"] = data.get("message")
if data.get('cod'):
data['cod'] = str(data['cod'])
# TODO: Handle failures
Expand Down

0 comments on commit 054de9b

Please sign in to comment.