python-weather 2.2.6__py3-none-any.whl → 2.2.8__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.
- python_weather/client.py +3 -2
- python_weather/constants.py +62 -21
- python_weather/enums.py +57 -47
- python_weather/forecast.py +2 -2
- python_weather/version.py +1 -1
- {python_weather-2.2.6.dist-info → python_weather-2.2.8.dist-info}/METADATA +6 -5
- python_weather-2.2.8.dist-info/RECORD +13 -0
- {python_weather-2.2.6.dist-info → python_weather-2.2.8.dist-info}/WHEEL +1 -1
- python_weather-2.2.6.dist-info/RECORD +0 -13
- {python_weather-2.2.6.dist-info → python_weather-2.2.8.dist-info}/licenses/LICENSE +0 -0
- {python_weather-2.2.6.dist-info → python_weather-2.2.8.dist-info}/top_level.txt +0 -0
python_weather/client.py
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
# SPDX-FileCopyrightText: 2021-2026 null8626
|
|
3
3
|
|
|
4
4
|
from asyncio import sleep
|
|
5
|
+
from typing import Self
|
|
5
6
|
from urllib.parse import quote_plus
|
|
6
7
|
|
|
7
8
|
from aiohttp import ClientResponseError, ClientSession, ClientTimeout, TCPConnector
|
|
@@ -69,7 +70,7 @@ class Client:
|
|
|
69
70
|
):
|
|
70
71
|
self.__own_session = session is None
|
|
71
72
|
self.__session = session or ClientSession(
|
|
72
|
-
timeout=ClientTimeout(total=
|
|
73
|
+
timeout=ClientTimeout(total=5.0),
|
|
73
74
|
connector=TCPConnector(ssl=False),
|
|
74
75
|
)
|
|
75
76
|
self._max_retries = max_retries
|
|
@@ -204,7 +205,7 @@ class Client:
|
|
|
204
205
|
if self.__own_session and not self.__session.closed:
|
|
205
206
|
await self.__session.close()
|
|
206
207
|
|
|
207
|
-
async def __aenter__(self) ->
|
|
208
|
+
async def __aenter__(self) -> Self:
|
|
208
209
|
"""Starts using the client. This method is no-op and just returns itself."""
|
|
209
210
|
return self
|
|
210
211
|
|
python_weather/constants.py
CHANGED
|
@@ -27,25 +27,66 @@ IMPERIAL = _Unit('F', 'Miles', 'Inches', 'Inches', 'Miles', 2.54)
|
|
|
27
27
|
LATLON_REGEX = re.compile(r'^Lat (\-?[\d\.]+) and Lon (\-?[\d\.]+)$')
|
|
28
28
|
TIME_REGEX = re.compile(r'^(\d{2}):(\d{2}) ([AP])M$')
|
|
29
29
|
|
|
30
|
-
KIND_EMOJIS =
|
|
31
|
-
'☀️',
|
|
32
|
-
'
|
|
33
|
-
'☁️',
|
|
34
|
-
'☁️',
|
|
35
|
-
'
|
|
36
|
-
'
|
|
37
|
-
'
|
|
38
|
-
'
|
|
39
|
-
'
|
|
40
|
-
'
|
|
41
|
-
'
|
|
42
|
-
'
|
|
43
|
-
'
|
|
44
|
-
'
|
|
45
|
-
'
|
|
46
|
-
'
|
|
47
|
-
'
|
|
48
|
-
'
|
|
49
|
-
'
|
|
50
|
-
|
|
30
|
+
KIND_EMOJIS = {
|
|
31
|
+
113: '☀️',
|
|
32
|
+
116: '⛅',
|
|
33
|
+
119: '☁️',
|
|
34
|
+
122: '☁️',
|
|
35
|
+
125: '🌫️',
|
|
36
|
+
128: '🌫️',
|
|
37
|
+
131: '💨',
|
|
38
|
+
134: '💨',
|
|
39
|
+
137: '💨',
|
|
40
|
+
140: '💨',
|
|
41
|
+
143: '🌫️',
|
|
42
|
+
146: '🌫️',
|
|
43
|
+
149: '🌫️',
|
|
44
|
+
152: '🌫️',
|
|
45
|
+
155: '🌫️',
|
|
46
|
+
158: '💨',
|
|
47
|
+
161: '💨',
|
|
48
|
+
176: '🌦️',
|
|
49
|
+
179: '🌨️',
|
|
50
|
+
182: '🌨️',
|
|
51
|
+
185: '🌧️',
|
|
52
|
+
200: '⛈️',
|
|
53
|
+
227: '💨',
|
|
54
|
+
230: '🌨️',
|
|
55
|
+
248: '🌫️',
|
|
56
|
+
260: '🌫️',
|
|
57
|
+
263: '🌦️',
|
|
58
|
+
266: '🌦️',
|
|
59
|
+
281: '🌧️',
|
|
60
|
+
284: '🌧️',
|
|
61
|
+
293: '🌦️',
|
|
62
|
+
296: '🌦️',
|
|
63
|
+
299: '🌧️',
|
|
64
|
+
302: '🌧️',
|
|
65
|
+
305: '🌧️',
|
|
66
|
+
308: '🌧️',
|
|
67
|
+
311: '🌧️',
|
|
68
|
+
314: '🌧️',
|
|
69
|
+
317: '🌨️',
|
|
70
|
+
320: '🌨️',
|
|
71
|
+
323: '🌨️',
|
|
72
|
+
326: '🌨️',
|
|
73
|
+
329: '🌨️',
|
|
74
|
+
332: '🌨️',
|
|
75
|
+
335: '🌨️',
|
|
76
|
+
338: '🌨️',
|
|
77
|
+
350: '🌨️',
|
|
78
|
+
353: '🌦️',
|
|
79
|
+
356: '🌧️',
|
|
80
|
+
359: '🌧️',
|
|
81
|
+
362: '🌨️',
|
|
82
|
+
365: '🌨️',
|
|
83
|
+
368: '🌨️',
|
|
84
|
+
371: '🌨️',
|
|
85
|
+
374: '🌨️',
|
|
86
|
+
377: '🌨️',
|
|
87
|
+
386: '⛈️',
|
|
88
|
+
389: '🌩️',
|
|
89
|
+
392: '⛈️',
|
|
90
|
+
395: '🌩️',
|
|
91
|
+
}
|
|
51
92
|
WIND_DIRECTION_EMOJIS = '↑', '↖', '←', '↙', '↓', '↘', '→', '↗'
|
python_weather/enums.py
CHANGED
|
@@ -280,58 +280,68 @@ class Kind(BasicEnum):
|
|
|
280
280
|
SUNNY = 113
|
|
281
281
|
PARTLY_CLOUDY = 116
|
|
282
282
|
CLOUDY = 119
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
HEAVY_SHOWERS = 299
|
|
293
|
-
HEAVY_RAIN = 302
|
|
294
|
-
LIGHT_SNOW_SHOWERS = 323
|
|
295
|
-
HEAVY_SNOW_SHOWERS = 335
|
|
296
|
-
THUNDERY_HEAVY_RAIN = 389
|
|
297
|
-
THUNDERY_SNOW_SHOWERS = 392
|
|
283
|
+
OVERCAST = 122
|
|
284
|
+
HAZE = 125
|
|
285
|
+
DUST_HAZE = 128
|
|
286
|
+
BLOWING_DUST = 131
|
|
287
|
+
DUST_STORM = 134
|
|
288
|
+
SANDSTORM = 137
|
|
289
|
+
SEVERE_SANDSTORM = 140
|
|
290
|
+
MIST = 143
|
|
291
|
+
SMOKE = 146
|
|
298
292
|
SMOKY_HAZE = 149
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
293
|
+
SMOG = 152
|
|
294
|
+
SEVERE_SMOG = 155
|
|
295
|
+
SAHARAN_DUST = 158
|
|
296
|
+
DUST = 161
|
|
297
|
+
PATCHY_RAIN_NEARBY = 176
|
|
298
|
+
PATCHY_SNOW_NEARBY = 179
|
|
299
|
+
PATCHY_SLEET_NEARBY = 182
|
|
300
|
+
PATCHY_FREEZING_DRIZZLE_NEARBY = 185
|
|
301
|
+
THUNDERY_OUTBREAKS_IN_NEARBY = 200
|
|
302
|
+
BLOWING_SNOW = 227
|
|
303
|
+
BLIZZARD = 230
|
|
304
|
+
FOG = 248
|
|
305
|
+
FREEZING_FOG = 260
|
|
306
|
+
PATCHY_LIGHT_DRIZZLE = 263
|
|
307
|
+
LIGHT_DRIZZLE = 266
|
|
308
|
+
FREEZING_DRIZZLE = 281
|
|
309
|
+
HEAVY_FREEZING_DRIZZLE = 284
|
|
310
|
+
PATCHY_LIGHT_RAIN = 293
|
|
311
|
+
LIGHT_RAIN = 296
|
|
312
|
+
MODERATE_RAIN_AT_TIMES = 299
|
|
313
|
+
MODERATE_RAIN = 302
|
|
314
|
+
HEAVY_RAIN_AT_TIMES = 305
|
|
315
|
+
HEAVY_RAIN = 308
|
|
316
|
+
LIGHT_FREEZING_RAIN = 311
|
|
317
|
+
MODERATE_OR_HEAVY_FREEZING_RAIN = 314
|
|
318
|
+
LIGHT_SLEET = 317
|
|
319
|
+
MODERATE_OR_HEAVY_SLEET = 320
|
|
320
|
+
PATCHY_LIGHT_SNOW = 323
|
|
321
|
+
LIGHT_SNOW = 326
|
|
322
|
+
PATCHY_MODERATE_SNOW = 329
|
|
323
|
+
MODERATE_SNOW = 332
|
|
324
|
+
PATCHY_HEAVY_SNOW = 335
|
|
325
|
+
HEAVY_SNOW = 338
|
|
326
|
+
ICE_PELLETS = 350
|
|
327
|
+
LIGHT_RAIN_SHOWER = 353
|
|
328
|
+
MODERATE_OR_HEAVY_RAIN_SHOWER = 356
|
|
329
|
+
TORRENTIAL_RAIN_SHOWER = 359
|
|
330
|
+
LIGHT_SLEET_SHOWERS = 362
|
|
331
|
+
MODERATE_OR_HEAVY_SLEET_SHOWERS = 365
|
|
332
|
+
LIGHT_SNOW_SHOWERS = 368
|
|
333
|
+
MODERATE_OR_HEAVY_SNOW_SHOWERS = 371
|
|
334
|
+
LIGHT_SHOWERS_OF_ICE_PELLETS = 374
|
|
335
|
+
MODERATE_OR_HEAVY_SHOWERS_OF_ICE_PELLETS = 377
|
|
336
|
+
PATCHY_LIGHT_RAIN_IN_AREA_WITH_THUNDER = 386
|
|
337
|
+
MODERATE_OR_HEAVY_RAIN_IN_AREA_WITH_THUNDER = 389
|
|
338
|
+
PATCHY_LIGHT_SNOW_IN_AREA_WITH_THUNDER = 392
|
|
339
|
+
MODERATE_OR_HEAVY_SNOW_IN_AREA_WITH_THUNDER = 395
|
|
330
340
|
|
|
331
341
|
@property
|
|
332
342
|
def emoji(self) -> str:
|
|
333
343
|
"""The weather forecast kind's emoji representation."""
|
|
334
|
-
return KIND_EMOJIS[self.
|
|
344
|
+
return KIND_EMOJIS[self.value]
|
|
335
345
|
|
|
336
346
|
|
|
337
347
|
class Phase(BasicEnum):
|
python_weather/forecast.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# SPDX-License-Identifier: MIT
|
|
2
2
|
# SPDX-FileCopyrightText: 2021-2026 null8626
|
|
3
3
|
|
|
4
|
-
from datetime import date, datetime, time
|
|
4
|
+
from datetime import UTC, date, datetime, time
|
|
5
5
|
from typing import TYPE_CHECKING
|
|
6
6
|
|
|
7
7
|
from .base import BaseForecast
|
|
@@ -268,7 +268,7 @@ class Forecast(BaseForecast):
|
|
|
268
268
|
self.location = nearest['areaName'][0]['value']
|
|
269
269
|
self.country = nearest['country'][0]['value']
|
|
270
270
|
self.datetime = datetime.combine(
|
|
271
|
-
datetime.
|
|
271
|
+
datetime.now(UTC), _parse_time(current['observation_time'])
|
|
272
272
|
)
|
|
273
273
|
|
|
274
274
|
try:
|
python_weather/version.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-weather
|
|
3
|
-
Version: 2.2.
|
|
3
|
+
Version: 2.2.8
|
|
4
4
|
Summary: A free and asynchronous weather API wrapper made in Python, for Python.
|
|
5
5
|
Author: null8626
|
|
6
6
|
License-Expression: MIT
|
|
@@ -30,17 +30,18 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
30
30
|
Classifier: Programming Language :: Python :: 3.12
|
|
31
31
|
Classifier: Programming Language :: Python :: 3.13
|
|
32
32
|
Classifier: Programming Language :: Python :: 3.14
|
|
33
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
33
34
|
Requires-Python: >=3.10
|
|
34
35
|
Description-Content-Type: text/markdown
|
|
35
36
|
License-File: LICENSE
|
|
36
37
|
Requires-Dist: aiohttp>=3.14.5
|
|
37
38
|
Provides-Extra: dev
|
|
38
39
|
Requires-Dist: mock>=5.2.0; extra == "dev"
|
|
39
|
-
Requires-Dist: pytest>=9.
|
|
40
|
-
Requires-Dist: pytest-asyncio>=1.
|
|
40
|
+
Requires-Dist: pytest>=9.2.0; extra == "dev"
|
|
41
|
+
Requires-Dist: pytest-asyncio>=1.5.0; extra == "dev"
|
|
41
42
|
Requires-Dist: pytest-cov>=7.1.0; extra == "dev"
|
|
42
|
-
Requires-Dist: multidict>=
|
|
43
|
-
Requires-Dist: yarl>=1.
|
|
43
|
+
Requires-Dist: multidict>=7.2.1; extra == "dev"
|
|
44
|
+
Requires-Dist: yarl>=1.25.1; extra == "dev"
|
|
44
45
|
Dynamic: license-file
|
|
45
46
|
|
|
46
47
|
# [python-weather][pypi-url] [![pypi][pypi-image]][pypi-url] [![pypi downloads][pypi-downloads-image]][pypi-url] [![codacy-badge][codacy-image]][codacy-url] [![codecov-badge][codecov-image]][codecov-url] [![ko-fi][ko-fi-brief-image]][ko-fi-url]
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
python_weather/__init__.py,sha256=LY7PmFAlyMF6_4CbprO9epFr_5EwPaJEUpkNuuggTXA,761
|
|
2
|
+
python_weather/base.py,sha256=sApqcPLFBhdoZPF5KwKIp529HF26dV0mhiCr0VRxycc,2272
|
|
3
|
+
python_weather/client.py,sha256=cVo0Dsb1HFlen08ZA7Q0kEj02rQigunVCdFsGgIoY0c,6136
|
|
4
|
+
python_weather/constants.py,sha256=0uEt6G9p-bDYDA3cYxasAVCwcLFUvWBWEmOghRfcWAk,1863
|
|
5
|
+
python_weather/enums.py,sha256=_XbhescyVyHt_uWxarzoYnAmNpqQpfntehYZk_HqSzY,8696
|
|
6
|
+
python_weather/errors.py,sha256=_B2puqZHJ8gxbnd3aRS_-YsExIf5wDLWPQKRwZxNp-I,793
|
|
7
|
+
python_weather/forecast.py,sha256=v7KcjeioZfiftxsw889bPwWqNM-wj60P5AcqAwRf0O0,8720
|
|
8
|
+
python_weather/version.py,sha256=ygsrw1hVIGFXP5cOEWVKiOcnc8viwsI6qeqfH_ujNhs,95
|
|
9
|
+
python_weather-2.2.8.dist-info/licenses/LICENSE,sha256=SDMQ_fK2dwWVC-3qqONf6VVMnBe-GtBtlfYZIN2SBXw,1080
|
|
10
|
+
python_weather-2.2.8.dist-info/METADATA,sha256=Psy-hZVbOlABFRN456oYwSe4OTvh3mKlVYGG7qkqoBc,4313
|
|
11
|
+
python_weather-2.2.8.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
12
|
+
python_weather-2.2.8.dist-info/top_level.txt,sha256=NDqLSO3dHB1tjjiNJfEg-a9_eoOmawAZynZsy9Yu48w,15
|
|
13
|
+
python_weather-2.2.8.dist-info/RECORD,,
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
python_weather/__init__.py,sha256=LY7PmFAlyMF6_4CbprO9epFr_5EwPaJEUpkNuuggTXA,761
|
|
2
|
-
python_weather/base.py,sha256=sApqcPLFBhdoZPF5KwKIp529HF26dV0mhiCr0VRxycc,2272
|
|
3
|
-
python_weather/client.py,sha256=8JzZU2T5zKch2lP79ooBQR4aVCxpvv5k8HUeJDwQTkQ,6119
|
|
4
|
-
python_weather/constants.py,sha256=X8olq7GffgRXEer_Ew2lRIx2tql2DnkNbA8xeIpdDvs,1014
|
|
5
|
-
python_weather/enums.py,sha256=jSOl2FSi7dhKbdafg2rCJ814bX5tHshXTPr4BlXbhcw,8453
|
|
6
|
-
python_weather/errors.py,sha256=_B2puqZHJ8gxbnd3aRS_-YsExIf5wDLWPQKRwZxNp-I,793
|
|
7
|
-
python_weather/forecast.py,sha256=ujiiJw0mrhykSkBwQGsVaalw20TS1dWUIRkhPEmni9E,8714
|
|
8
|
-
python_weather/version.py,sha256=1pmY2I5-x17tKQcE-Zhy52kOpU0z4GG9-CzHn_hME78,95
|
|
9
|
-
python_weather-2.2.6.dist-info/licenses/LICENSE,sha256=SDMQ_fK2dwWVC-3qqONf6VVMnBe-GtBtlfYZIN2SBXw,1080
|
|
10
|
-
python_weather-2.2.6.dist-info/METADATA,sha256=z3hpYx-gL5CpK5NSwgrfJuAXORnDwafes_M5RSjODEk,4262
|
|
11
|
-
python_weather-2.2.6.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
|
|
12
|
-
python_weather-2.2.6.dist-info/top_level.txt,sha256=NDqLSO3dHB1tjjiNJfEg-a9_eoOmawAZynZsy9Yu48w,15
|
|
13
|
-
python_weather-2.2.6.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|