python-google-weather-api 0.0.2__py3-none-any.whl → 0.0.4__py3-none-any.whl
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.
- google_weather_api/__init__.py +57 -2
- google_weather_api/api.py +30 -21
- google_weather_api/exceptions.py +13 -0
- google_weather_api/model.py +631 -0
- {python_google_weather_api-0.0.2.dist-info → python_google_weather_api-0.0.4.dist-info}/METADATA +3 -2
- python_google_weather_api-0.0.4.dist-info/RECORD +10 -0
- python_google_weather_api-0.0.2.dist-info/RECORD +0 -8
- {python_google_weather_api-0.0.2.dist-info → python_google_weather_api-0.0.4.dist-info}/WHEEL +0 -0
- {python_google_weather_api-0.0.2.dist-info → python_google_weather_api-0.0.4.dist-info}/licenses/LICENSE +0 -0
- {python_google_weather_api-0.0.2.dist-info → python_google_weather_api-0.0.4.dist-info}/top_level.txt +0 -0
google_weather_api/__init__.py
CHANGED
@@ -1,15 +1,70 @@
|
|
1
1
|
"""A python client library for Google Weather API."""
|
2
2
|
|
3
|
-
from .api import
|
4
|
-
|
3
|
+
from .api import GoogleWeatherApi
|
4
|
+
from .exceptions import (
|
5
5
|
GoogleWeatherApiConnectionError,
|
6
6
|
GoogleWeatherApiError,
|
7
7
|
GoogleWeatherApiResponseError,
|
8
8
|
)
|
9
|
+
from .model import (
|
10
|
+
AirPressure,
|
11
|
+
CurrentConditionsHistory,
|
12
|
+
CurrentConditionsResponse,
|
13
|
+
DailyForecastResponse,
|
14
|
+
Date,
|
15
|
+
DateTime,
|
16
|
+
ForecastDay,
|
17
|
+
ForecastDayPart,
|
18
|
+
ForecastHour,
|
19
|
+
HourlyForecastResponse,
|
20
|
+
IceThickness,
|
21
|
+
Interval,
|
22
|
+
LocalizedText,
|
23
|
+
MoonEvents,
|
24
|
+
Precipitation,
|
25
|
+
PrecipitationProbability,
|
26
|
+
QuantitativePrecipitationForecast,
|
27
|
+
SunEvents,
|
28
|
+
Temperature,
|
29
|
+
TimeZone,
|
30
|
+
Visibility,
|
31
|
+
WeatherCondition,
|
32
|
+
Wind,
|
33
|
+
WindDirection,
|
34
|
+
WindSpeed,
|
35
|
+
)
|
9
36
|
|
10
37
|
__all__ = [
|
38
|
+
# API
|
11
39
|
"GoogleWeatherApi",
|
40
|
+
# Exceptions
|
12
41
|
"GoogleWeatherApiConnectionError",
|
13
42
|
"GoogleWeatherApiError",
|
14
43
|
"GoogleWeatherApiResponseError",
|
44
|
+
# Models
|
45
|
+
"AirPressure",
|
46
|
+
"CurrentConditionsHistory",
|
47
|
+
"CurrentConditionsResponse",
|
48
|
+
"Date",
|
49
|
+
"DailyForecastResponse",
|
50
|
+
"DateTime",
|
51
|
+
"ForecastDay",
|
52
|
+
"ForecastDayPart",
|
53
|
+
"ForecastHour",
|
54
|
+
"HourlyForecastResponse",
|
55
|
+
"IceThickness",
|
56
|
+
"Interval",
|
57
|
+
"LocalizedText",
|
58
|
+
"MoonEvents",
|
59
|
+
"Precipitation",
|
60
|
+
"PrecipitationProbability",
|
61
|
+
"QuantitativePrecipitationForecast",
|
62
|
+
"SunEvents",
|
63
|
+
"Temperature",
|
64
|
+
"TimeZone",
|
65
|
+
"Visibility",
|
66
|
+
"WeatherCondition",
|
67
|
+
"Wind",
|
68
|
+
"WindDirection",
|
69
|
+
"WindSpeed",
|
15
70
|
]
|
google_weather_api/api.py
CHANGED
@@ -8,18 +8,15 @@ from typing import Any
|
|
8
8
|
|
9
9
|
import aiohttp
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
class GoogleWeatherApiResponseError(GoogleWeatherApiError):
|
21
|
-
"""Exception raised for errors in the Google Weather API response."""
|
22
|
-
|
11
|
+
from .exceptions import (
|
12
|
+
GoogleWeatherApiConnectionError,
|
13
|
+
GoogleWeatherApiResponseError,
|
14
|
+
)
|
15
|
+
from .model import (
|
16
|
+
CurrentConditionsResponse,
|
17
|
+
DailyForecastResponse,
|
18
|
+
HourlyForecastResponse,
|
19
|
+
)
|
23
20
|
|
24
21
|
_LOGGER = logging.getLogger(__name__)
|
25
22
|
|
@@ -79,21 +76,28 @@ class GoogleWeatherApi:
|
|
79
76
|
|
80
77
|
async def async_get_current_conditions(
|
81
78
|
self, latitude: float, longitude: float
|
82
|
-
) ->
|
83
|
-
"""Fetch current weather conditions.
|
84
|
-
|
79
|
+
) -> CurrentConditionsResponse:
|
80
|
+
"""Fetch current weather conditions.
|
81
|
+
|
82
|
+
See https://developers.google.com/maps/documentation/weather/reference/rest/v1/currentConditions/lookup
|
83
|
+
"""
|
84
|
+
data = await self._async_get(
|
85
85
|
"currentConditions:lookup",
|
86
86
|
{
|
87
87
|
"location.latitude": latitude,
|
88
88
|
"location.longitude": longitude,
|
89
89
|
},
|
90
90
|
)
|
91
|
+
return CurrentConditionsResponse.from_dict(data)
|
91
92
|
|
92
93
|
async def async_get_hourly_forecast(
|
93
94
|
self, latitude: float, longitude: float, hours: int = 48
|
94
|
-
) ->
|
95
|
-
"""Fetch hourly weather forecast.
|
96
|
-
|
95
|
+
) -> HourlyForecastResponse:
|
96
|
+
"""Fetch hourly weather forecast.
|
97
|
+
|
98
|
+
See https://developers.google.com/maps/documentation/weather/reference/rest/v1/forecast.hours/lookup
|
99
|
+
"""
|
100
|
+
data = await self._async_get(
|
97
101
|
"forecast/hours:lookup",
|
98
102
|
{
|
99
103
|
"location.latitude": latitude,
|
@@ -102,12 +106,16 @@ class GoogleWeatherApi:
|
|
102
106
|
"page_size": hours,
|
103
107
|
},
|
104
108
|
)
|
109
|
+
return HourlyForecastResponse.from_dict(data)
|
105
110
|
|
106
111
|
async def async_get_daily_forecast(
|
107
112
|
self, latitude: float, longitude: float, days: int = 10
|
108
|
-
) ->
|
109
|
-
"""Fetch daily weather forecast.
|
110
|
-
|
113
|
+
) -> DailyForecastResponse:
|
114
|
+
"""Fetch daily weather forecast.
|
115
|
+
|
116
|
+
See https://developers.google.com/maps/documentation/weather/reference/rest/v1/forecast.days/lookup
|
117
|
+
"""
|
118
|
+
data = await self._async_get(
|
111
119
|
"forecast/days:lookup",
|
112
120
|
{
|
113
121
|
"location.latitude": latitude,
|
@@ -116,3 +124,4 @@ class GoogleWeatherApi:
|
|
116
124
|
"page_size": days,
|
117
125
|
},
|
118
126
|
)
|
127
|
+
return DailyForecastResponse.from_dict(data)
|
@@ -0,0 +1,13 @@
|
|
1
|
+
"""Exceptions for Google Weather API."""
|
2
|
+
|
3
|
+
|
4
|
+
class GoogleWeatherApiError(Exception):
|
5
|
+
"""Exception talking to the Google Weather API."""
|
6
|
+
|
7
|
+
|
8
|
+
class GoogleWeatherApiConnectionError(GoogleWeatherApiError):
|
9
|
+
"""Exception connecting to the Google Weather API."""
|
10
|
+
|
11
|
+
|
12
|
+
class GoogleWeatherApiResponseError(GoogleWeatherApiError):
|
13
|
+
"""Exception raised for errors in the Google Weather API response."""
|
@@ -0,0 +1,631 @@
|
|
1
|
+
"""Models for the Google Weather API."""
|
2
|
+
|
3
|
+
from __future__ import annotations
|
4
|
+
|
5
|
+
from dataclasses import dataclass, field
|
6
|
+
from enum import StrEnum
|
7
|
+
|
8
|
+
from mashumaro.mixins.json import DataClassJSONMixin
|
9
|
+
|
10
|
+
|
11
|
+
@dataclass
|
12
|
+
class AirPressure(DataClassJSONMixin):
|
13
|
+
"""Represents the atmospheric air pressure conditions."""
|
14
|
+
|
15
|
+
mean_sea_level_millibars: float = field(metadata={"alias": "meanSeaLevelMillibars"})
|
16
|
+
"""The mean sea level air pressure in millibars."""
|
17
|
+
|
18
|
+
|
19
|
+
@dataclass
|
20
|
+
class Interval(DataClassJSONMixin):
|
21
|
+
"""Represents a time interval."""
|
22
|
+
|
23
|
+
start_time: str = field(metadata={"alias": "startTime"})
|
24
|
+
"""Inclusive start of the interval in RFC 3339 format."""
|
25
|
+
|
26
|
+
end_time: str | None = field(default=None, metadata={"alias": "endTime"})
|
27
|
+
"""Optional. Exclusive end of the interval in RFC 3339 format."""
|
28
|
+
|
29
|
+
|
30
|
+
@dataclass
|
31
|
+
class TimeZone(DataClassJSONMixin):
|
32
|
+
"""Represents a time zone from the IANA Time Zone Database."""
|
33
|
+
|
34
|
+
id: str
|
35
|
+
"""IANA Time Zone Database time zone. For example "America/New_York"."""
|
36
|
+
|
37
|
+
version: str | None = None
|
38
|
+
"""Optional. IANA Time Zone Database version number. For example "2019a"."""
|
39
|
+
|
40
|
+
|
41
|
+
@dataclass
|
42
|
+
class LocalizedText(DataClassJSONMixin):
|
43
|
+
"""Localized variant of a text in a particular language."""
|
44
|
+
|
45
|
+
text: str
|
46
|
+
"""Localized string in the language corresponding to languageCode below."""
|
47
|
+
|
48
|
+
language_code: str = field(metadata={"alias": "languageCode"})
|
49
|
+
"""The text's BCP-47 language code, such as "en-US" or "sr-Latn"."""
|
50
|
+
|
51
|
+
|
52
|
+
@dataclass
|
53
|
+
class Temperature(DataClassJSONMixin):
|
54
|
+
"""Represents a temperature value."""
|
55
|
+
|
56
|
+
class TemperatureUnit(StrEnum):
|
57
|
+
"""Represents a unit used to measure temperatures."""
|
58
|
+
|
59
|
+
TEMPERATURE_UNIT_UNSPECIFIED = "TEMPERATURE_UNIT_UNSPECIFIED"
|
60
|
+
CELSIUS = "CELSIUS"
|
61
|
+
FAHRENHEIT = "FAHRENHEIT"
|
62
|
+
|
63
|
+
degrees: float
|
64
|
+
"""The temperature value (in degrees) in the specified unit."""
|
65
|
+
|
66
|
+
unit: TemperatureUnit
|
67
|
+
"""The code for the unit used to measure the temperature value."""
|
68
|
+
|
69
|
+
|
70
|
+
@dataclass
|
71
|
+
class QuantitativePrecipitationForecast(DataClassJSONMixin):
|
72
|
+
"""Represents the expected amount of melted precipitation."""
|
73
|
+
|
74
|
+
class Unit(StrEnum):
|
75
|
+
"""Represents the unit used to measure the amount of accumulated precipitation."""
|
76
|
+
|
77
|
+
UNIT_UNSPECIFIED = "UNIT_UNSPECIFIED"
|
78
|
+
MILLIMETERS = "MILLIMETERS"
|
79
|
+
INCHES = "INCHES"
|
80
|
+
|
81
|
+
quantity: float
|
82
|
+
"""The amount of precipitation, measured as liquid water equivalent."""
|
83
|
+
|
84
|
+
unit: Unit
|
85
|
+
"""The code of the unit used to measure the amount of accumulated precipitation."""
|
86
|
+
|
87
|
+
|
88
|
+
@dataclass
|
89
|
+
class PrecipitationProbability(DataClassJSONMixin):
|
90
|
+
"""Represents the probability of precipitation at a given location."""
|
91
|
+
|
92
|
+
class PrecipitationType(StrEnum):
|
93
|
+
"""Represents the type of precipitation at a given location."""
|
94
|
+
|
95
|
+
PRECIPITATION_TYPE_UNSPECIFIED = "PRECIPITATION_TYPE_UNSPECIFIED"
|
96
|
+
NONE = "NONE"
|
97
|
+
SNOW = "SNOW"
|
98
|
+
RAIN = "RAIN"
|
99
|
+
LIGHT_RAIN = "LIGHT_RAIN"
|
100
|
+
HEAVY_RAIN = "HEAVY_RAIN"
|
101
|
+
RAIN_AND_SNOW = "RAIN_AND_SNOW"
|
102
|
+
SLEET = "SLEET"
|
103
|
+
FREEZING_RAIN = "FREEZING_RAIN"
|
104
|
+
|
105
|
+
type: PrecipitationType
|
106
|
+
"""A code that indicates the type of precipitation."""
|
107
|
+
|
108
|
+
percent: int
|
109
|
+
"""A percentage from 0 to 100 that indicates the chances of precipitation."""
|
110
|
+
|
111
|
+
|
112
|
+
@dataclass
|
113
|
+
class Precipitation(DataClassJSONMixin):
|
114
|
+
"""Represents a set of precipitation values at a given location."""
|
115
|
+
|
116
|
+
probability: PrecipitationProbability
|
117
|
+
"""The probability of precipitation (values from 0 to 100)."""
|
118
|
+
|
119
|
+
qpf: QuantitativePrecipitationForecast
|
120
|
+
"""The amount of precipitation (rain or snow), measured as liquid water."""
|
121
|
+
|
122
|
+
snow_qpf: QuantitativePrecipitationForecast | None = field(
|
123
|
+
default=None, metadata={"alias": "snowQpf"}
|
124
|
+
)
|
125
|
+
"""The amount of snow accumulation, measured as liquid water equivalent."""
|
126
|
+
|
127
|
+
|
128
|
+
@dataclass
|
129
|
+
class WindSpeed(DataClassJSONMixin):
|
130
|
+
"""Represents the speed of the wind."""
|
131
|
+
|
132
|
+
class SpeedUnit(StrEnum):
|
133
|
+
"""Represents the unit used to measure speed."""
|
134
|
+
|
135
|
+
SPEED_UNIT_UNSPECIFIED = "SPEED_UNIT_UNSPECIFIED"
|
136
|
+
KILOMETERS_PER_HOUR = "KILOMETERS_PER_HOUR"
|
137
|
+
MILES_PER_HOUR = "MILES_PER_HOUR"
|
138
|
+
|
139
|
+
value: float
|
140
|
+
"""The value of the wind speed."""
|
141
|
+
|
142
|
+
unit: SpeedUnit
|
143
|
+
"""The code that represents the unit used to measure the wind speed."""
|
144
|
+
|
145
|
+
|
146
|
+
@dataclass
|
147
|
+
class WindDirection(DataClassJSONMixin):
|
148
|
+
"""Represents the direction from which the wind originates."""
|
149
|
+
|
150
|
+
class CardinalDirection(StrEnum):
|
151
|
+
"""Represents a cardinal direction (including ordinal directions)."""
|
152
|
+
|
153
|
+
CARDINAL_DIRECTION_UNSPECIFIED = "CARDINAL_DIRECTION_UNSPECIFIED"
|
154
|
+
NORTH = "NORTH"
|
155
|
+
NORTH_NORTHEAST = "NORTH_NORTHEAST"
|
156
|
+
NORTHEAST = "NORTHEAST"
|
157
|
+
EAST_NORTHEAST = "EAST_NORTHEAST"
|
158
|
+
EAST = "EAST"
|
159
|
+
EAST_SOUTHEAST = "EAST_SOUTHEAST"
|
160
|
+
SOUTHEAST = "SOUTHEAST"
|
161
|
+
SOUTH_SOUTHEAST = "SOUTH_SOUTHEAST"
|
162
|
+
SOUTH = "SOUTH"
|
163
|
+
SOUTH_SOUTHWEST = "SOUTH_SOUTHWEST"
|
164
|
+
SOUTHWEST = "SOUTHWEST"
|
165
|
+
WEST_SOUTHWEST = "WEST_SOUTHWEST"
|
166
|
+
WEST = "WEST"
|
167
|
+
WEST_NORTHWEST = "WEST_NORTHWEST"
|
168
|
+
NORTHWEST = "NORTHWEST"
|
169
|
+
NORTH_NORTHWEST = "NORTH_NORTHWEST"
|
170
|
+
|
171
|
+
degrees: int
|
172
|
+
"""The direction of the wind in degrees (values from 0 to 360)."""
|
173
|
+
|
174
|
+
cardinal: CardinalDirection
|
175
|
+
"""The code that represents the cardinal direction from which the wind is blowing."""
|
176
|
+
|
177
|
+
|
178
|
+
@dataclass
|
179
|
+
class Wind(DataClassJSONMixin):
|
180
|
+
"""Represents a set of wind properties."""
|
181
|
+
|
182
|
+
direction: WindDirection
|
183
|
+
"""The direction of the wind, the angle it is coming from."""
|
184
|
+
|
185
|
+
speed: WindSpeed
|
186
|
+
"""The speed of the wind."""
|
187
|
+
|
188
|
+
gust: WindSpeed
|
189
|
+
"""The wind gust (sudden increase in the wind speed)."""
|
190
|
+
|
191
|
+
|
192
|
+
@dataclass
|
193
|
+
class Visibility(DataClassJSONMixin):
|
194
|
+
"""Represents visibility conditions, the distance at which objects can be discerned."""
|
195
|
+
|
196
|
+
class Unit(StrEnum):
|
197
|
+
"""Represents the unit used to measure the visibility distance."""
|
198
|
+
|
199
|
+
UNIT_UNSPECIFIED = "UNIT_UNSPECIFIED"
|
200
|
+
KILOMETERS = "KILOMETERS"
|
201
|
+
MILES = "MILES"
|
202
|
+
|
203
|
+
distance: float
|
204
|
+
"""The visibility distance in the specified unit."""
|
205
|
+
|
206
|
+
unit: Unit
|
207
|
+
"""The code that represents the unit used to measure the distance."""
|
208
|
+
|
209
|
+
|
210
|
+
@dataclass
|
211
|
+
class WeatherCondition(DataClassJSONMixin):
|
212
|
+
"""Represents a weather condition for a given location at a given period of time."""
|
213
|
+
|
214
|
+
class Type(StrEnum):
|
215
|
+
"""Marks the weather condition type in a forecast element's context."""
|
216
|
+
|
217
|
+
TYPE_UNSPECIFIED = "TYPE_UNSPECIFIED"
|
218
|
+
CLEAR = "CLEAR"
|
219
|
+
MOSTLY_CLEAR = "MOSTLY_CLEAR"
|
220
|
+
PARTLY_CLOUDY = "PARTLY_CLOUDY"
|
221
|
+
MOSTLY_CLOUDY = "MOSTLY_CLOUDY"
|
222
|
+
CLOUDY = "CLOUDY"
|
223
|
+
WINDY = "WINDY"
|
224
|
+
WIND_AND_RAIN = "WIND_AND_RAIN"
|
225
|
+
LIGHT_RAIN_SHOWERS = "LIGHT_RAIN_SHOWERS"
|
226
|
+
CHANCE_OF_SHOWERS = "CHANCE_OF_SHOWERS"
|
227
|
+
SCATTERED_SHOWERS = "SCATTERED_SHOWERS"
|
228
|
+
RAIN_SHOWERS = "RAIN_SHOWERS"
|
229
|
+
HEAVY_RAIN_SHOWERS = "HEAVY_RAIN_SHOWERS"
|
230
|
+
LIGHT_TO_MODERATE_RAIN = "LIGHT_TO_MODERATE_RAIN"
|
231
|
+
MODERATE_TO_HEAVY_RAIN = "MODERATE_TO_HEAVY_RAIN"
|
232
|
+
RAIN = "RAIN"
|
233
|
+
LIGHT_RAIN = "LIGHT_RAIN"
|
234
|
+
HEAVY_RAIN = "HEAVY_RAIN"
|
235
|
+
RAIN_PERIODICALLY_HEAVY = "RAIN_PERIODICALLY_HEAVY"
|
236
|
+
LIGHT_SNOW_SHOWERS = "LIGHT_SNOW_SHOWERS"
|
237
|
+
CHANCE_OF_SNOW_SHOWERS = "CHANCE_OF_SNOW_SHOWERS"
|
238
|
+
SCATTERED_SNOW_SHOWERS = "SCATTERED_SNOW_SHOWERS"
|
239
|
+
SNOW_SHOWERS = "SNOW_SHOWERS"
|
240
|
+
HEAVY_SNOW_SHOWERS = "HEAVY_SNOW_SHOWERS"
|
241
|
+
LIGHT_TO_MODERATE_SNOW = "LIGHT_TO_MODERATE_SNOW"
|
242
|
+
MODERATE_TO_HEAVY_SNOW = "MODERATE_TO_HEAVY_SNOW"
|
243
|
+
SNOW = "SNOW"
|
244
|
+
LIGHT_SNOW = "LIGHT_SNOW"
|
245
|
+
HEAVY_SNOW = "HEAVY_SNOW"
|
246
|
+
SNOWSTORM = "SNOWSTORM"
|
247
|
+
SNOW_PERIODICALLY_HEAVY = "SNOW_PERIODICALLY_HEAVY"
|
248
|
+
HEAVY_SNOW_STORM = "HEAVY_SNOW_STORM"
|
249
|
+
BLOWING_SNOW = "BLOWING_SNOW"
|
250
|
+
RAIN_AND_SNOW = "RAIN_AND_SNOW"
|
251
|
+
HAIL = "HAIL"
|
252
|
+
HAIL_SHOWERS = "HAIL_SHOWERS"
|
253
|
+
THUNDERSTORM = "THUNDERSTORM"
|
254
|
+
THUNDERSHOWER = "THUNDERSHOWER"
|
255
|
+
LIGHT_THUNDERSTORM_RAIN = "LIGHT_THUNDERSTORM_RAIN"
|
256
|
+
SCATTERED_THUNDERSTORMS = "SCATTERED_THUNDERSTORMS"
|
257
|
+
HEAVY_THUNDERSTORM = "HEAVY_THUNDERSTORM"
|
258
|
+
|
259
|
+
icon_base_uri: str = field(metadata={"alias": "iconBaseUri"})
|
260
|
+
"""The base URI for the icon not including the file type extension."""
|
261
|
+
|
262
|
+
description: LocalizedText
|
263
|
+
"""The textual description for this weather condition (localized)."""
|
264
|
+
|
265
|
+
type: Type
|
266
|
+
"""The type of weather condition."""
|
267
|
+
|
268
|
+
|
269
|
+
@dataclass
|
270
|
+
class IceThickness(DataClassJSONMixin):
|
271
|
+
"""Represents ice thickness conditions."""
|
272
|
+
|
273
|
+
class Unit(StrEnum):
|
274
|
+
"""Represents the unit used to measure the ice thickness."""
|
275
|
+
|
276
|
+
UNIT_UNSPECIFIED = "UNIT_UNSPECIFIED"
|
277
|
+
MILLIMETERS = "MILLIMETERS"
|
278
|
+
INCHES = "INCHES"
|
279
|
+
|
280
|
+
thickness: float
|
281
|
+
"""The ice thickness value."""
|
282
|
+
|
283
|
+
unit: Unit
|
284
|
+
"""The code that represents the unit used to measure the ice thickness."""
|
285
|
+
|
286
|
+
|
287
|
+
@dataclass
|
288
|
+
class CurrentConditionsHistory(DataClassJSONMixin):
|
289
|
+
"""Represents a set of changes in the current conditions over the last 24 hours."""
|
290
|
+
|
291
|
+
temperature_change: Temperature = field(metadata={"alias": "temperatureChange"})
|
292
|
+
"""The current temperature minus the temperature 24 hours ago."""
|
293
|
+
|
294
|
+
max_temperature: Temperature = field(metadata={"alias": "maxTemperature"})
|
295
|
+
"""The maximum (high) temperature in the past 24 hours."""
|
296
|
+
|
297
|
+
min_temperature: Temperature = field(metadata={"alias": "minTemperature"})
|
298
|
+
"""The minimum (low) temperature in the past 24 hours."""
|
299
|
+
|
300
|
+
qpf: QuantitativePrecipitationForecast
|
301
|
+
"""The amount of precipitation (rain or snow) accumulated over the last 24 hours."""
|
302
|
+
|
303
|
+
|
304
|
+
@dataclass
|
305
|
+
class CurrentConditionsResponse(DataClassJSONMixin):
|
306
|
+
"""Response model for the currentConditions.lookup method."""
|
307
|
+
|
308
|
+
current_time: str = field(metadata={"alias": "currentTime"})
|
309
|
+
"""Current time (UTC) associated with the returned data."""
|
310
|
+
|
311
|
+
time_zone: TimeZone = field(metadata={"alias": "timeZone"})
|
312
|
+
"""The time zone at the requested location."""
|
313
|
+
|
314
|
+
weather_condition: WeatherCondition = field(metadata={"alias": "weatherCondition"})
|
315
|
+
"""The current weather condition."""
|
316
|
+
|
317
|
+
temperature: Temperature
|
318
|
+
"""The current temperature."""
|
319
|
+
|
320
|
+
feels_like_temperature: Temperature = field(
|
321
|
+
metadata={"alias": "feelsLikeTemperature"}
|
322
|
+
)
|
323
|
+
"""The measure of how the temperature currently feels like."""
|
324
|
+
|
325
|
+
dew_point: Temperature = field(metadata={"alias": "dewPoint"})
|
326
|
+
"""The current dew point temperature."""
|
327
|
+
|
328
|
+
heat_index: Temperature = field(metadata={"alias": "heatIndex"})
|
329
|
+
"""The current heat index temperature."""
|
330
|
+
|
331
|
+
wind_chill: Temperature = field(metadata={"alias": "windChill"})
|
332
|
+
"""The current wind chill, air temperature exposed on the skin."""
|
333
|
+
|
334
|
+
precipitation: Precipitation
|
335
|
+
"""Current precipitation probability and accumulated amount over the last hour."""
|
336
|
+
|
337
|
+
air_pressure: AirPressure = field(metadata={"alias": "airPressure"})
|
338
|
+
"""The current air pressure conditions."""
|
339
|
+
|
340
|
+
wind: Wind
|
341
|
+
"""The current wind conditions."""
|
342
|
+
|
343
|
+
visibility: Visibility
|
344
|
+
"""The current visibility."""
|
345
|
+
|
346
|
+
current_conditions_history: CurrentConditionsHistory = field(
|
347
|
+
metadata={"alias": "currentConditionsHistory"}
|
348
|
+
)
|
349
|
+
"""The changes in the current conditions over the last 24 hours."""
|
350
|
+
|
351
|
+
is_daytime: bool = field(metadata={"alias": "isDaytime"})
|
352
|
+
"""True if the current time is between local sunrise (inclusive) and sunset."""
|
353
|
+
|
354
|
+
relative_humidity: int = field(metadata={"alias": "relativeHumidity"})
|
355
|
+
"""The current percent of relative humidity (0-100)."""
|
356
|
+
|
357
|
+
uv_index: int = field(metadata={"alias": "uvIndex"})
|
358
|
+
"""The current ultraviolet (UV) index."""
|
359
|
+
|
360
|
+
thunderstorm_probability: int = field(metadata={"alias": "thunderstormProbability"})
|
361
|
+
"""The current thunderstorm probability (0-100)."""
|
362
|
+
|
363
|
+
cloud_cover: int = field(metadata={"alias": "cloudCover"})
|
364
|
+
"""The current percentage of the sky covered by clouds (0-100)."""
|
365
|
+
|
366
|
+
|
367
|
+
@dataclass
|
368
|
+
class Date(DataClassJSONMixin):
|
369
|
+
"""Represents a whole or partial calendar date."""
|
370
|
+
|
371
|
+
year: int
|
372
|
+
"""Year of the date. Must be from 1 to 9999, or 0."""
|
373
|
+
|
374
|
+
month: int
|
375
|
+
"""Month of a year. Must be from 1 to 12, or 0."""
|
376
|
+
|
377
|
+
day: int
|
378
|
+
"""Day of a month. Must be from 1 to 31, or 0."""
|
379
|
+
|
380
|
+
|
381
|
+
@dataclass
|
382
|
+
class ForecastDayPart(DataClassJSONMixin):
|
383
|
+
"""Represents a forecast record for a part of the day (daytime or nighttime)."""
|
384
|
+
|
385
|
+
interval: Interval
|
386
|
+
"""The UTC date and time when this part of the day starts and ends."""
|
387
|
+
|
388
|
+
weather_condition: WeatherCondition = field(metadata={"alias": "weatherCondition"})
|
389
|
+
"""The forecasted weather condition."""
|
390
|
+
|
391
|
+
precipitation: Precipitation
|
392
|
+
"""The forecasted precipitation."""
|
393
|
+
|
394
|
+
wind: Wind
|
395
|
+
"""The average wind direction and maximum speed and gust."""
|
396
|
+
|
397
|
+
relative_humidity: int = field(metadata={"alias": "relativeHumidity"})
|
398
|
+
"""The forecasted percent of relative humidity (0-100)."""
|
399
|
+
|
400
|
+
uv_index: int = field(metadata={"alias": "uvIndex"})
|
401
|
+
"""The maximum forecasted ultraviolet (UV) index."""
|
402
|
+
|
403
|
+
thunderstorm_probability: int = field(metadata={"alias": "thunderstormProbability"})
|
404
|
+
"""The average thunderstorm probability."""
|
405
|
+
|
406
|
+
cloud_cover: int = field(metadata={"alias": "cloudCover"})
|
407
|
+
"""Average cloud cover percent."""
|
408
|
+
|
409
|
+
ice_thickness: IceThickness | None = field(
|
410
|
+
default=None, metadata={"alias": "iceThickness"}
|
411
|
+
)
|
412
|
+
"""The forecasted ice thickness."""
|
413
|
+
|
414
|
+
|
415
|
+
@dataclass
|
416
|
+
class SunEvents(DataClassJSONMixin):
|
417
|
+
"""Represents the events related to the sun (e.g. sunrise, sunset)."""
|
418
|
+
|
419
|
+
sunrise_time: str | None = field(default=None, metadata={"alias": "sunriseTime"})
|
420
|
+
"""The time when the sun rises. Unset in polar regions."""
|
421
|
+
|
422
|
+
sunset_time: str | None = field(default=None, metadata={"alias": "sunsetTime"})
|
423
|
+
"""The time when the sun sets. Unset in polar regions."""
|
424
|
+
|
425
|
+
|
426
|
+
@dataclass
|
427
|
+
class MoonEvents(DataClassJSONMixin):
|
428
|
+
"""Represents the events related to the moon (e.g. moonrise, moonset)."""
|
429
|
+
|
430
|
+
class MoonPhase(StrEnum):
|
431
|
+
"""Marks the moon phase (a.k.a. lunar phase)."""
|
432
|
+
|
433
|
+
MOON_PHASE_UNSPECIFIED = "MOON_PHASE_UNSPECIFIED"
|
434
|
+
NEW_MOON = "NEW_MOON"
|
435
|
+
WAXING_CRESCENT = "WAXING_CRESCENT"
|
436
|
+
FIRST_QUARTER = "FIRST_QUARTER"
|
437
|
+
WAXING_GIBBOUS = "WAXING_GIBBOUS"
|
438
|
+
FULL_MOON = "FULL_MOON"
|
439
|
+
WANING_GIBBOUS = "WANING_GIBBOUS"
|
440
|
+
LAST_QUARTER = "LAST_QUARTER"
|
441
|
+
WANING_CRESCENT = "WANING_CRESCENT"
|
442
|
+
|
443
|
+
moon_phase: MoonPhase = field(metadata={"alias": "moonPhase"})
|
444
|
+
"""The moon phase (a.k.a. lunar phase)."""
|
445
|
+
|
446
|
+
moonrise_times: list[str] = field(
|
447
|
+
default_factory=list, metadata={"alias": "moonriseTimes"}
|
448
|
+
)
|
449
|
+
"""The time(s) when the upper limb of the moon appears above the horizon."""
|
450
|
+
|
451
|
+
moonset_times: list[str] = field(
|
452
|
+
default_factory=list, metadata={"alias": "moonsetTimes"}
|
453
|
+
)
|
454
|
+
"""The time(s) when the upper limb of the moon disappears below the horizon."""
|
455
|
+
|
456
|
+
|
457
|
+
@dataclass
|
458
|
+
class ForecastDay(DataClassJSONMixin):
|
459
|
+
"""Represents a daily forecast record at a given location."""
|
460
|
+
|
461
|
+
interval: Interval
|
462
|
+
"""The UTC time interval when this forecasted day starts and ends."""
|
463
|
+
|
464
|
+
display_date: Date = field(metadata={"alias": "displayDate"})
|
465
|
+
"""The local date in the time zone of the location."""
|
466
|
+
|
467
|
+
daytime_forecast: ForecastDayPart = field(metadata={"alias": "daytimeForecast"})
|
468
|
+
"""The forecasted weather conditions for the daytime part of the day."""
|
469
|
+
|
470
|
+
nighttime_forecast: ForecastDayPart = field(metadata={"alias": "nighttimeForecast"})
|
471
|
+
"""The forecasted weather conditions for the nighttime part of the day."""
|
472
|
+
|
473
|
+
max_temperature: Temperature = field(metadata={"alias": "maxTemperature"})
|
474
|
+
"""The maximum (high) temperature throughout the day."""
|
475
|
+
|
476
|
+
min_temperature: Temperature = field(metadata={"alias": "minTemperature"})
|
477
|
+
"""The minimum (low) temperature throughout the day."""
|
478
|
+
|
479
|
+
feels_like_max_temperature: Temperature = field(
|
480
|
+
metadata={"alias": "feelsLikeMaxTemperature"}
|
481
|
+
)
|
482
|
+
"""The maximum (high) feels-like temperature throughout the day."""
|
483
|
+
|
484
|
+
feels_like_min_temperature: Temperature = field(
|
485
|
+
metadata={"alias": "feelsLikeMinTemperature"}
|
486
|
+
)
|
487
|
+
"""The minimum (low) feels-like temperature throughout the day."""
|
488
|
+
|
489
|
+
max_heat_index: Temperature = field(metadata={"alias": "maxHeatIndex"})
|
490
|
+
"""The maximum heat index temperature throughout the day."""
|
491
|
+
|
492
|
+
sun_events: SunEvents = field(metadata={"alias": "sunEvents"})
|
493
|
+
"""The events related to the sun (e.g. sunrise, sunset)."""
|
494
|
+
|
495
|
+
moon_events: MoonEvents = field(metadata={"alias": "moonEvents"})
|
496
|
+
"""The events related to the moon (e.g. moonrise, moonset)."""
|
497
|
+
|
498
|
+
ice_thickness: IceThickness | None = field(
|
499
|
+
default=None, metadata={"alias": "iceThickness"}
|
500
|
+
)
|
501
|
+
"""The accumulated amount of ice throughout the entire day."""
|
502
|
+
|
503
|
+
|
504
|
+
@dataclass
|
505
|
+
class DailyForecastResponse(DataClassJSONMixin):
|
506
|
+
"""Response model for the forecast.days.lookup method."""
|
507
|
+
|
508
|
+
forecast_days: list[ForecastDay] = field(metadata={"alias": "forecastDays"})
|
509
|
+
"""The daily forecast records."""
|
510
|
+
|
511
|
+
time_zone: TimeZone = field(metadata={"alias": "timeZone"})
|
512
|
+
"""The time zone at the requested location."""
|
513
|
+
|
514
|
+
next_page_token: str | None = field(
|
515
|
+
default=None, metadata={"alias": "nextPageToken"}
|
516
|
+
)
|
517
|
+
"""The token to retrieve the next page."""
|
518
|
+
|
519
|
+
|
520
|
+
@dataclass
|
521
|
+
class DateTime(DataClassJSONMixin):
|
522
|
+
"""Represents civil time (or occasionally physical time)."""
|
523
|
+
|
524
|
+
year: int | None = None
|
525
|
+
"""Optional. Year of date. Must be from 1 to 9999, or 0."""
|
526
|
+
|
527
|
+
month: int | None = None
|
528
|
+
"""Optional. Month of year. Must be from 1 to 12, or 0."""
|
529
|
+
|
530
|
+
day: int | None = None
|
531
|
+
"""Optional. Day of month. Must be from 1 to 31, or 0."""
|
532
|
+
|
533
|
+
hours: int | None = None
|
534
|
+
"""Optional. Hours of day in 24 hour format. Should be from 0 to 23."""
|
535
|
+
|
536
|
+
minutes: int | None = None
|
537
|
+
"""Optional. Minutes of hour of day. Must be from 0 to 59."""
|
538
|
+
|
539
|
+
seconds: int | None = None
|
540
|
+
"""Optional. Seconds of minutes of the time. Must normally be from 0 to 59."""
|
541
|
+
|
542
|
+
nanos: int | None = None
|
543
|
+
"""Optional. Fractions of seconds in nanoseconds."""
|
544
|
+
|
545
|
+
utc_offset: str | None = field(default=None, metadata={"alias": "utcOffset"})
|
546
|
+
"""Optional. UTC offset. Must be whole seconds, between -18 and +18 hours."""
|
547
|
+
|
548
|
+
time_zone: TimeZone | None = field(default=None, metadata={"alias": "timeZone"})
|
549
|
+
"""Optional. Time zone."""
|
550
|
+
|
551
|
+
|
552
|
+
@dataclass
|
553
|
+
class ForecastHour(DataClassJSONMixin):
|
554
|
+
"""Represents an hourly forecast record at a given location."""
|
555
|
+
|
556
|
+
interval: Interval
|
557
|
+
"""The one hour interval (in UTC time) this forecast data is valid for."""
|
558
|
+
|
559
|
+
display_date_time: DateTime = field(metadata={"alias": "displayDateTime"})
|
560
|
+
"""The local date and time in the time zone of the location."""
|
561
|
+
|
562
|
+
weather_condition: WeatherCondition = field(metadata={"alias": "weatherCondition"})
|
563
|
+
"""The forecasted weather condition."""
|
564
|
+
|
565
|
+
temperature: Temperature
|
566
|
+
"""The forecasted temperature."""
|
567
|
+
|
568
|
+
feels_like_temperature: Temperature = field(
|
569
|
+
metadata={"alias": "feelsLikeTemperature"}
|
570
|
+
)
|
571
|
+
"""The measure of how the temperature will feel like."""
|
572
|
+
|
573
|
+
dew_point: Temperature = field(metadata={"alias": "dewPoint"})
|
574
|
+
"""The forecasted dew point temperature."""
|
575
|
+
|
576
|
+
heat_index: Temperature = field(metadata={"alias": "heatIndex"})
|
577
|
+
"""The forecasted heat index temperature."""
|
578
|
+
|
579
|
+
wind_chill: Temperature = field(metadata={"alias": "windChill"})
|
580
|
+
"""The forecasted wind chill, air temperature exposed on the skin."""
|
581
|
+
|
582
|
+
wet_bulb_temperature: Temperature = field(metadata={"alias": "wetBulbTemperature"})
|
583
|
+
"""The forecasted wet bulb temperature, lowest temperature achievable by evaporating water."""
|
584
|
+
|
585
|
+
precipitation: Precipitation
|
586
|
+
"""The forecasted precipitation probability and amount over the last hour."""
|
587
|
+
|
588
|
+
air_pressure: AirPressure = field(metadata={"alias": "airPressure"})
|
589
|
+
"""The forecasted air pressure conditions."""
|
590
|
+
|
591
|
+
wind: Wind
|
592
|
+
"""The forecasted wind conditions."""
|
593
|
+
|
594
|
+
visibility: Visibility
|
595
|
+
"""The forecasted visibility."""
|
596
|
+
|
597
|
+
is_daytime: bool = field(metadata={"alias": "isDaytime"})
|
598
|
+
"""True if this hour is between the local sunrise (inclusive) and sunset."""
|
599
|
+
|
600
|
+
relative_humidity: int = field(metadata={"alias": "relativeHumidity"})
|
601
|
+
"""The forecasted percent of relative humidity (0-100)."""
|
602
|
+
|
603
|
+
uv_index: int = field(metadata={"alias": "uvIndex"})
|
604
|
+
"""The forecasted ultraviolet (UV) index."""
|
605
|
+
|
606
|
+
thunderstorm_probability: int = field(metadata={"alias": "thunderstormProbability"})
|
607
|
+
"""The forecasted thunderstorm probability (0-100)."""
|
608
|
+
|
609
|
+
cloud_cover: int = field(metadata={"alias": "cloudCover"})
|
610
|
+
"""The forecasted percentage of the sky covered by clouds (0-100)."""
|
611
|
+
|
612
|
+
ice_thickness: IceThickness | None = field(
|
613
|
+
default=None, metadata={"alias": "iceThickness"}
|
614
|
+
)
|
615
|
+
"""The forecasted ice thickness."""
|
616
|
+
|
617
|
+
|
618
|
+
@dataclass
|
619
|
+
class HourlyForecastResponse(DataClassJSONMixin):
|
620
|
+
"""Response model for the forecast.hours.lookup method."""
|
621
|
+
|
622
|
+
forecast_hours: list[ForecastHour] = field(metadata={"alias": "forecastHours"})
|
623
|
+
"""The hourly forecast records."""
|
624
|
+
|
625
|
+
time_zone: TimeZone = field(metadata={"alias": "timeZone"})
|
626
|
+
"""The time zone at the requested location."""
|
627
|
+
|
628
|
+
next_page_token: str | None = field(
|
629
|
+
default=None, metadata={"alias": "nextPageToken"}
|
630
|
+
)
|
631
|
+
"""The token to retrieve the next page."""
|
{python_google_weather_api-0.0.2.dist-info → python_google_weather_api-0.0.4.dist-info}/METADATA
RENAMED
@@ -1,15 +1,16 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: python-google-weather-api
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.4
|
4
4
|
Summary: A python client library for Google Weather API
|
5
5
|
Author-email: tronikos <tronikos@gmail.com>
|
6
6
|
License-Expression: Apache-2.0
|
7
7
|
Project-URL: Homepage, https://github.com/tronikos/python-google-weather-api
|
8
8
|
Project-URL: Bug Tracker, https://github.com/tronikos/python-google-weather-api/issues
|
9
|
-
Requires-Python: >=3.
|
9
|
+
Requires-Python: >=3.11
|
10
10
|
Description-Content-Type: text/markdown
|
11
11
|
License-File: LICENSE
|
12
12
|
Requires-Dist: aiohttp>=3.8
|
13
|
+
Requires-Dist: mashumaro
|
13
14
|
Provides-Extra: dev
|
14
15
|
Requires-Dist: pytest>=7; extra == "dev"
|
15
16
|
Dynamic: license-file
|
@@ -0,0 +1,10 @@
|
|
1
|
+
google_weather_api/__init__.py,sha256=-QhZtqKdRYohLgaw5DwSa81EnrRWQ6Wb0j5A0SS5Qcs,1465
|
2
|
+
google_weather_api/api.py,sha256=_exNxMthEln2iho93Uk_P7-zKJDj-oAZu77yQPau_zk,4271
|
3
|
+
google_weather_api/exceptions.py,sha256=RnF47YwX0K-COrEi1E9r5xoBXPPOHBGr_unpHzlje2U,409
|
4
|
+
google_weather_api/model.py,sha256=mAI-79Qo-6zJJowlDG4QSCjIpNjRlHhgZ3SnBsJLSqk,22309
|
5
|
+
google_weather_api/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
6
|
+
python_google_weather_api-0.0.4.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
7
|
+
python_google_weather_api-0.0.4.dist-info/METADATA,sha256=7X_qQm039FmHyTThQtS6U5sr_x7JWVO6zZItg6v74Ks,1498
|
8
|
+
python_google_weather_api-0.0.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
9
|
+
python_google_weather_api-0.0.4.dist-info/top_level.txt,sha256=ZkFbtKDHz3vUJhH6DGEPVLj3PPeNpR9-Wg0f4HqGD78,19
|
10
|
+
python_google_weather_api-0.0.4.dist-info/RECORD,,
|
@@ -1,8 +0,0 @@
|
|
1
|
-
google_weather_api/__init__.py,sha256=StgTuTikqdXIOy3irBdYqJs-MdACKiz7rbDbwfnraVE,341
|
2
|
-
google_weather_api/api.py,sha256=cxppiiV20mgh4E1a28MHTeGxbEYI7qPQB5yjVZ1OqnQ,3868
|
3
|
-
google_weather_api/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
4
|
-
python_google_weather_api-0.0.2.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
5
|
-
python_google_weather_api-0.0.2.dist-info/METADATA,sha256=BWUd_LcbefaSU1k5XKVExygyi-krYqL-TAo8FDKGXEc,1473
|
6
|
-
python_google_weather_api-0.0.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
7
|
-
python_google_weather_api-0.0.2.dist-info/top_level.txt,sha256=ZkFbtKDHz3vUJhH6DGEPVLj3PPeNpR9-Wg0f4HqGD78,19
|
8
|
-
python_google_weather_api-0.0.2.dist-info/RECORD,,
|
{python_google_weather_api-0.0.2.dist-info → python_google_weather_api-0.0.4.dist-info}/WHEEL
RENAMED
File without changes
|
File without changes
|
File without changes
|