python-google-weather-api 0.0.1__tar.gz → 0.0.2__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.1/src/python_google_weather_api.egg-info → python_google_weather_api-0.0.2}/PKG-INFO +1 -1
- {python_google_weather_api-0.0.1 → python_google_weather_api-0.0.2}/pyproject.toml +1 -1
- {python_google_weather_api-0.0.1 → python_google_weather_api-0.0.2}/src/google_weather_api/api.py +22 -15
- {python_google_weather_api-0.0.1 → python_google_weather_api-0.0.2/src/python_google_weather_api.egg-info}/PKG-INFO +1 -1
- {python_google_weather_api-0.0.1 → python_google_weather_api-0.0.2}/LICENSE +0 -0
- {python_google_weather_api-0.0.1 → python_google_weather_api-0.0.2}/README.md +0 -0
- {python_google_weather_api-0.0.1 → python_google_weather_api-0.0.2}/setup.cfg +0 -0
- {python_google_weather_api-0.0.1 → python_google_weather_api-0.0.2}/src/google_weather_api/__init__.py +0 -0
- {python_google_weather_api-0.0.1 → python_google_weather_api-0.0.2}/src/google_weather_api/py.typed +0 -0
- {python_google_weather_api-0.0.1 → python_google_weather_api-0.0.2}/src/python_google_weather_api.egg-info/SOURCES.txt +0 -0
- {python_google_weather_api-0.0.1 → python_google_weather_api-0.0.2}/src/python_google_weather_api.egg-info/dependency_links.txt +0 -0
- {python_google_weather_api-0.0.1 → python_google_weather_api-0.0.2}/src/python_google_weather_api.egg-info/requires.txt +0 -0
- {python_google_weather_api-0.0.1 → python_google_weather_api-0.0.2}/src/python_google_weather_api.egg-info/top_level.txt +0 -0
- {python_google_weather_api-0.0.1 → python_google_weather_api-0.0.2}/tests/test_api.py +0 -0
{python_google_weather_api-0.0.1 → python_google_weather_api-0.0.2}/src/google_weather_api/api.py
RENAMED
@@ -34,8 +34,6 @@ class GoogleWeatherApi:
|
|
34
34
|
self,
|
35
35
|
session: aiohttp.ClientSession,
|
36
36
|
api_key: str,
|
37
|
-
latitude: float,
|
38
|
-
longitude: float,
|
39
37
|
language_code: str = "en",
|
40
38
|
units_system: str = "METRIC",
|
41
39
|
referrer: str | None = None,
|
@@ -44,8 +42,6 @@ class GoogleWeatherApi:
|
|
44
42
|
"""Initialize the Google Weather API client."""
|
45
43
|
self.session = session
|
46
44
|
self.api_key = api_key
|
47
|
-
self.latitude = latitude
|
48
|
-
self.longitude = longitude
|
49
45
|
self.language_code = language_code
|
50
46
|
self.units_system = units_system
|
51
47
|
self.referrer = referrer
|
@@ -62,8 +58,6 @@ class GoogleWeatherApi:
|
|
62
58
|
"key": self.api_key,
|
63
59
|
"language_code": self.language_code,
|
64
60
|
"units_system": self.units_system,
|
65
|
-
"location.latitude": self.latitude,
|
66
|
-
"location.longitude": self.longitude,
|
67
61
|
}
|
68
62
|
_LOGGER.debug("GET %s with params: %s", url, params)
|
69
63
|
try:
|
@@ -78,33 +72,46 @@ class GoogleWeatherApi:
|
|
78
72
|
if resp.status != HTTPStatus.OK:
|
79
73
|
raise GoogleWeatherApiResponseError(res["error"]["message"])
|
80
74
|
return res
|
81
|
-
except
|
82
|
-
raise GoogleWeatherApiConnectionError(
|
83
|
-
|
84
|
-
) from err
|
85
|
-
|
86
|
-
async def async_get_current_conditions(
|
75
|
+
except TimeoutError as err:
|
76
|
+
raise GoogleWeatherApiConnectionError("Timeout") from err
|
77
|
+
except aiohttp.ClientError as err:
|
78
|
+
raise GoogleWeatherApiConnectionError(err) from err
|
79
|
+
|
80
|
+
async def async_get_current_conditions(
|
81
|
+
self, latitude: float, longitude: float
|
82
|
+
) -> dict[str, Any]:
|
87
83
|
"""Fetch current weather conditions."""
|
88
84
|
return await self._async_get(
|
89
85
|
"currentConditions:lookup",
|
90
|
-
{
|
86
|
+
{
|
87
|
+
"location.latitude": latitude,
|
88
|
+
"location.longitude": longitude,
|
89
|
+
},
|
91
90
|
)
|
92
91
|
|
93
|
-
async def async_get_hourly_forecast(
|
92
|
+
async def async_get_hourly_forecast(
|
93
|
+
self, latitude: float, longitude: float, hours: int = 48
|
94
|
+
) -> dict[str, Any]:
|
94
95
|
"""Fetch hourly weather forecast."""
|
95
96
|
return await self._async_get(
|
96
97
|
"forecast/hours:lookup",
|
97
98
|
{
|
99
|
+
"location.latitude": latitude,
|
100
|
+
"location.longitude": longitude,
|
98
101
|
"hours": hours,
|
99
102
|
"page_size": hours,
|
100
103
|
},
|
101
104
|
)
|
102
105
|
|
103
|
-
async def async_get_daily_forecast(
|
106
|
+
async def async_get_daily_forecast(
|
107
|
+
self, latitude: float, longitude: float, days: int = 10
|
108
|
+
) -> dict[str, Any]:
|
104
109
|
"""Fetch daily weather forecast."""
|
105
110
|
return await self._async_get(
|
106
111
|
"forecast/days:lookup",
|
107
112
|
{
|
113
|
+
"location.latitude": latitude,
|
114
|
+
"location.longitude": longitude,
|
108
115
|
"days": days,
|
109
116
|
"page_size": days,
|
110
117
|
},
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{python_google_weather_api-0.0.1 → python_google_weather_api-0.0.2}/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
|