diff --git a/neon_api_proxy/client/open_weather_map.py b/neon_api_proxy/client/open_weather_map.py index 0cfb3cf..3454839 100644 --- a/neon_api_proxy/client/open_weather_map.py +++ b/neon_api_proxy/client/open_weather_map.py @@ -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