python-google-weather-api 0.0.5__tar.gz → 0.0.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {python_google_weather_api-0.0.5/src/python_google_weather_api.egg-info → python_google_weather_api-0.0.6}/PKG-INFO +1 -1
- {python_google_weather_api-0.0.5 → python_google_weather_api-0.0.6}/pyproject.toml +1 -1
- {python_google_weather_api-0.0.5 → python_google_weather_api-0.0.6}/src/google_weather_api/api.py +12 -2
- {python_google_weather_api-0.0.5 → python_google_weather_api-0.0.6/src/python_google_weather_api.egg-info}/PKG-INFO +1 -1
- {python_google_weather_api-0.0.5 → python_google_weather_api-0.0.6}/LICENSE +0 -0
- {python_google_weather_api-0.0.5 → python_google_weather_api-0.0.6}/README.md +0 -0
- {python_google_weather_api-0.0.5 → python_google_weather_api-0.0.6}/setup.cfg +0 -0
- {python_google_weather_api-0.0.5 → python_google_weather_api-0.0.6}/src/google_weather_api/__init__.py +0 -0
- {python_google_weather_api-0.0.5 → python_google_weather_api-0.0.6}/src/google_weather_api/exceptions.py +0 -0
- {python_google_weather_api-0.0.5 → python_google_weather_api-0.0.6}/src/google_weather_api/model.py +0 -0
- {python_google_weather_api-0.0.5 → python_google_weather_api-0.0.6}/src/google_weather_api/py.typed +0 -0
- {python_google_weather_api-0.0.5 → python_google_weather_api-0.0.6}/src/python_google_weather_api.egg-info/SOURCES.txt +0 -0
- {python_google_weather_api-0.0.5 → python_google_weather_api-0.0.6}/src/python_google_weather_api.egg-info/dependency_links.txt +0 -0
- {python_google_weather_api-0.0.5 → python_google_weather_api-0.0.6}/src/python_google_weather_api.egg-info/requires.txt +0 -0
- {python_google_weather_api-0.0.5 → python_google_weather_api-0.0.6}/src/python_google_weather_api.egg-info/top_level.txt +0 -0
- {python_google_weather_api-0.0.5 → python_google_weather_api-0.0.6}/tests/test_api.py +0 -0
{python_google_weather_api-0.0.5 → python_google_weather_api-0.0.6}/src/google_weather_api/api.py
RENAMED
|
@@ -68,9 +68,19 @@ class GoogleWeatherApi:
|
|
|
68
68
|
res: dict[str, Any] = await resp.json()
|
|
69
69
|
_LOGGER.debug("Got %s for %s", resp.status, url)
|
|
70
70
|
if resp.status != HTTPStatus.OK:
|
|
71
|
+
error_data = res.get("error", {})
|
|
72
|
+
error_msg = error_data.get("message", "Unknown API error")
|
|
73
|
+
|
|
71
74
|
if resp.status in (HTTPStatus.UNAUTHORIZED, HTTPStatus.FORBIDDEN):
|
|
72
|
-
raise GoogleWeatherApiAuthError(
|
|
73
|
-
|
|
75
|
+
raise GoogleWeatherApiAuthError(error_msg)
|
|
76
|
+
|
|
77
|
+
# Google APIs often return 400 Bad Request for invalid API keys
|
|
78
|
+
if resp.status == HTTPStatus.BAD_REQUEST:
|
|
79
|
+
for detail in error_data.get("details", []):
|
|
80
|
+
if detail.get("reason") == "API_KEY_INVALID":
|
|
81
|
+
raise GoogleWeatherApiAuthError(error_msg)
|
|
82
|
+
|
|
83
|
+
raise GoogleWeatherApiResponseError(error_msg)
|
|
74
84
|
return res
|
|
75
85
|
except TimeoutError as err:
|
|
76
86
|
raise GoogleWeatherApiConnectionError("Timeout") from err
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_google_weather_api-0.0.5 → python_google_weather_api-0.0.6}/src/google_weather_api/model.py
RENAMED
|
File without changes
|
{python_google_weather_api-0.0.5 → python_google_weather_api-0.0.6}/src/google_weather_api/py.typed
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|