python-weather 2.2.2__tar.gz → 2.2.3__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_weather-2.2.2/python_weather.egg-info → python_weather-2.2.3}/PKG-INFO +10 -10
- {python_weather-2.2.2 → python_weather-2.2.3}/README.md +5 -5
- {python_weather-2.2.2 → python_weather-2.2.3}/pyproject.toml +3 -3
- {python_weather-2.2.2 → python_weather-2.2.3}/python_weather/__init__.py +5 -6
- {python_weather-2.2.2 → python_weather-2.2.3}/python_weather/base.py +6 -6
- {python_weather-2.2.2 → python_weather-2.2.3}/python_weather/client.py +6 -5
- {python_weather-2.2.2 → python_weather-2.2.3}/python_weather/constants.py +2 -1
- {python_weather-2.2.2 → python_weather-2.2.3}/python_weather/enums.py +1 -0
- {python_weather-2.2.2 → python_weather-2.2.3}/python_weather/forecast.py +15 -15
- {python_weather-2.2.2 → python_weather-2.2.3}/python_weather/version.py +1 -1
- {python_weather-2.2.2 → python_weather-2.2.3/python_weather.egg-info}/PKG-INFO +10 -10
- python_weather-2.2.3/python_weather.egg-info/requires.txt +9 -0
- python_weather-2.2.2/python_weather.egg-info/requires.txt +0 -9
- {python_weather-2.2.2 → python_weather-2.2.3}/LICENSE +0 -0
- {python_weather-2.2.2 → python_weather-2.2.3}/MANIFEST.in +0 -0
- {python_weather-2.2.2 → python_weather-2.2.3}/python_weather/errors.py +0 -0
- {python_weather-2.2.2 → python_weather-2.2.3}/python_weather.egg-info/SOURCES.txt +0 -0
- {python_weather-2.2.2 → python_weather-2.2.3}/python_weather.egg-info/dependency_links.txt +0 -0
- {python_weather-2.2.2 → python_weather-2.2.3}/python_weather.egg-info/top_level.txt +0 -0
- {python_weather-2.2.2 → python_weather-2.2.3}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-weather
|
|
3
|
-
Version: 2.2.
|
|
3
|
+
Version: 2.2.3
|
|
4
4
|
Summary: A free and asynchronous weather API wrapper made in Python, for Python.
|
|
5
5
|
Author: null8626
|
|
6
6
|
License-Expression: MIT
|
|
@@ -33,14 +33,14 @@ Classifier: Programming Language :: Python :: 3.14
|
|
|
33
33
|
Requires-Python: >=3.10
|
|
34
34
|
Description-Content-Type: text/markdown
|
|
35
35
|
License-File: LICENSE
|
|
36
|
-
Requires-Dist: aiohttp>=3.
|
|
36
|
+
Requires-Dist: aiohttp>=3.14.3
|
|
37
37
|
Provides-Extra: dev
|
|
38
38
|
Requires-Dist: mock>=5.2.0; extra == "dev"
|
|
39
|
-
Requires-Dist: pytest>=9.
|
|
40
|
-
Requires-Dist: pytest-asyncio>=1.
|
|
39
|
+
Requires-Dist: pytest>=9.1.1; extra == "dev"
|
|
40
|
+
Requires-Dist: pytest-asyncio>=1.4.0; extra == "dev"
|
|
41
41
|
Requires-Dist: pytest-cov>=7.1.0; extra == "dev"
|
|
42
42
|
Requires-Dist: multidict>=6.7.1; extra == "dev"
|
|
43
|
-
Requires-Dist: yarl>=1.
|
|
43
|
+
Requires-Dist: yarl>=1.24.5; extra == "dev"
|
|
44
44
|
Dynamic: license-file
|
|
45
45
|
|
|
46
46
|
# [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]
|
|
@@ -78,24 +78,24 @@ import asyncio
|
|
|
78
78
|
|
|
79
79
|
|
|
80
80
|
async def main() -> None:
|
|
81
|
-
|
|
81
|
+
|
|
82
82
|
# Declare the client. The measuring unit used defaults to the metric system (celcius, km/h, etc.)
|
|
83
83
|
async with python_weather.Client(unit=python_weather.IMPERIAL) as client:
|
|
84
|
-
|
|
85
84
|
# Fetch a weather forecast from a city.
|
|
86
85
|
weather = await client.get('New York')
|
|
87
|
-
|
|
86
|
+
|
|
88
87
|
# Fetch the temperature for today.
|
|
89
88
|
print(weather.temperature)
|
|
90
|
-
|
|
89
|
+
|
|
91
90
|
# Fetch weather forecast for upcoming days.
|
|
92
91
|
for daily in weather:
|
|
93
92
|
print(daily)
|
|
94
|
-
|
|
93
|
+
|
|
95
94
|
# Each daily forecast has their own hourly forecasts.
|
|
96
95
|
for hourly in daily:
|
|
97
96
|
print(f' --> {hourly!r}')
|
|
98
97
|
|
|
98
|
+
|
|
99
99
|
if __name__ == '__main__':
|
|
100
100
|
asyncio.run(main())
|
|
101
101
|
```
|
|
@@ -33,24 +33,24 @@ import asyncio
|
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
async def main() -> None:
|
|
36
|
-
|
|
36
|
+
|
|
37
37
|
# Declare the client. The measuring unit used defaults to the metric system (celcius, km/h, etc.)
|
|
38
38
|
async with python_weather.Client(unit=python_weather.IMPERIAL) as client:
|
|
39
|
-
|
|
40
39
|
# Fetch a weather forecast from a city.
|
|
41
40
|
weather = await client.get('New York')
|
|
42
|
-
|
|
41
|
+
|
|
43
42
|
# Fetch the temperature for today.
|
|
44
43
|
print(weather.temperature)
|
|
45
|
-
|
|
44
|
+
|
|
46
45
|
# Fetch weather forecast for upcoming days.
|
|
47
46
|
for daily in weather:
|
|
48
47
|
print(daily)
|
|
49
|
-
|
|
48
|
+
|
|
50
49
|
# Each daily forecast has their own hourly forecasts.
|
|
51
50
|
for hourly in daily:
|
|
52
51
|
print(f' --> {hourly!r}')
|
|
53
52
|
|
|
53
|
+
|
|
54
54
|
if __name__ == '__main__':
|
|
55
55
|
asyncio.run(main())
|
|
56
56
|
```
|
|
@@ -3,13 +3,13 @@ requires = ["setuptools"]
|
|
|
3
3
|
|
|
4
4
|
[project]
|
|
5
5
|
name = "python-weather"
|
|
6
|
-
version = "2.2.
|
|
6
|
+
version = "2.2.3"
|
|
7
7
|
description = "A free and asynchronous weather API wrapper made in Python, for Python."
|
|
8
8
|
readme = "README.md"
|
|
9
9
|
license = "MIT"
|
|
10
10
|
authors = [{ name = "null8626" }]
|
|
11
11
|
keywords = ["weather", "forecast", "weather-forecast"]
|
|
12
|
-
dependencies = ["aiohttp>=3.
|
|
12
|
+
dependencies = ["aiohttp>=3.14.3"]
|
|
13
13
|
classifiers = [
|
|
14
14
|
"Development Status :: 5 - Production/Stable",
|
|
15
15
|
"Intended Audience :: Education",
|
|
@@ -35,7 +35,7 @@ classifiers = [
|
|
|
35
35
|
requires-python = ">=3.10"
|
|
36
36
|
|
|
37
37
|
[project.optional-dependencies]
|
|
38
|
-
dev = ["mock>=5.2.0", "pytest>=9.
|
|
38
|
+
dev = ["mock>=5.2.0", "pytest>=9.1.1", "pytest-asyncio>=1.4.0", "pytest-cov>=7.1.0", "multidict>=6.7.1", "yarl>=1.24.5"]
|
|
39
39
|
|
|
40
40
|
[project.urls]
|
|
41
41
|
Documentation = "https://python-weather.readthedocs.io/en/latest/"
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
# SPDX-License-Identifier: MIT
|
|
2
2
|
# SPDX-FileCopyrightText: 2021-2026 null8626
|
|
3
3
|
|
|
4
|
+
from .client import Client
|
|
5
|
+
from .constants import IMPERIAL, METRIC
|
|
4
6
|
from .enums import HeatIndex, Kind, Locale, Phase, UltraViolet, WindDirection
|
|
5
|
-
from .constants import METRIC, IMPERIAL
|
|
6
7
|
from .errors import Error, RequestError
|
|
7
8
|
from .forecast import Forecast
|
|
8
9
|
from .version import VERSION
|
|
9
|
-
from .client import Client
|
|
10
|
-
|
|
11
10
|
|
|
12
11
|
__title__ = 'python-weather'
|
|
13
12
|
__author__ = 'null8626'
|
|
@@ -18,17 +17,17 @@ __license__ = 'MIT'
|
|
|
18
17
|
__copyright__ = 'Copyright (c) 2021-2026 null8626'
|
|
19
18
|
__version__ = VERSION
|
|
20
19
|
__all__ = (
|
|
21
|
-
'METRIC',
|
|
22
20
|
'IMPERIAL',
|
|
21
|
+
'METRIC',
|
|
22
|
+
'VERSION',
|
|
23
23
|
'Client',
|
|
24
24
|
'Error',
|
|
25
25
|
'Forecast',
|
|
26
|
-
'RequestError',
|
|
27
26
|
'HeatIndex',
|
|
28
27
|
'Kind',
|
|
29
28
|
'Locale',
|
|
30
29
|
'Phase',
|
|
30
|
+
'RequestError',
|
|
31
31
|
'UltraViolet',
|
|
32
|
-
'VERSION',
|
|
33
32
|
'WindDirection',
|
|
34
33
|
)
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
from typing import TYPE_CHECKING
|
|
5
5
|
|
|
6
|
-
from .enums import
|
|
6
|
+
from .enums import Kind, Locale, UltraViolet, WindDirection
|
|
7
7
|
|
|
8
8
|
if TYPE_CHECKING:
|
|
9
9
|
from .constants import _Unit
|
|
@@ -14,17 +14,17 @@ class BaseForecast:
|
|
|
14
14
|
|
|
15
15
|
__slots__: tuple[str, ...] = (
|
|
16
16
|
'cloud_cover',
|
|
17
|
-
'
|
|
17
|
+
'description',
|
|
18
|
+
'feels_like',
|
|
18
19
|
'humidity',
|
|
19
|
-
'wind_direction',
|
|
20
20
|
'kind',
|
|
21
|
-
'feels_like',
|
|
22
|
-
'temperature',
|
|
23
21
|
'precipitation',
|
|
24
22
|
'pressure',
|
|
23
|
+
'temperature',
|
|
24
|
+
'ultraviolet',
|
|
25
25
|
'visibility',
|
|
26
|
+
'wind_direction',
|
|
26
27
|
'wind_speed',
|
|
27
|
-
'description',
|
|
28
28
|
)
|
|
29
29
|
|
|
30
30
|
cloud_cover: int
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
# SPDX-License-Identifier: MIT
|
|
2
2
|
# SPDX-FileCopyrightText: 2021-2026 null8626
|
|
3
3
|
|
|
4
|
-
from aiohttp import ClientSession, ClientTimeout, ClientResponseError, TCPConnector
|
|
5
|
-
from urllib.parse import quote_plus
|
|
6
4
|
from asyncio import sleep
|
|
5
|
+
from urllib.parse import quote_plus
|
|
7
6
|
|
|
7
|
+
from aiohttp import ClientResponseError, ClientSession, ClientTimeout, TCPConnector
|
|
8
|
+
|
|
9
|
+
from .constants import METRIC, _Unit
|
|
10
|
+
from .enums import Locale
|
|
8
11
|
from .errors import Error, RequestError
|
|
9
|
-
from .constants import _Unit, METRIC
|
|
10
12
|
from .forecast import Forecast
|
|
11
13
|
from .version import VERSION
|
|
12
|
-
from .enums import Locale
|
|
13
14
|
|
|
14
15
|
|
|
15
16
|
class Client:
|
|
@@ -47,9 +48,9 @@ class Client:
|
|
|
47
48
|
__slots__: tuple[str, ...] = (
|
|
48
49
|
'__own_session',
|
|
49
50
|
'__session',
|
|
51
|
+
'_locale',
|
|
50
52
|
'_max_retries',
|
|
51
53
|
'_unit',
|
|
52
|
-
'_locale',
|
|
53
54
|
)
|
|
54
55
|
|
|
55
56
|
__own_session: bool
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# SPDX-License-Identifier: MIT
|
|
2
2
|
# SPDX-FileCopyrightText: 2021-2026 null8626
|
|
3
3
|
|
|
4
|
-
from dataclasses import dataclass
|
|
5
4
|
import re
|
|
5
|
+
from dataclasses import dataclass
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
@dataclass(frozen=True, repr=False, slots=True)
|
|
@@ -45,5 +45,6 @@ KIND_EMOJIS = (
|
|
|
45
45
|
'❄️',
|
|
46
46
|
'🌩',
|
|
47
47
|
'⛈',
|
|
48
|
+
'🌫',
|
|
48
49
|
)
|
|
49
50
|
WIND_DIRECTION_EMOJIS = '↑', '↖', '←', '↙', '↓', '↘', '→', '↗'
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# SPDX-License-Identifier: MIT
|
|
2
2
|
# SPDX-FileCopyrightText: 2021-2026 null8626
|
|
3
3
|
|
|
4
|
-
from datetime import
|
|
4
|
+
from datetime import date, datetime, time
|
|
5
5
|
from typing import TYPE_CHECKING
|
|
6
6
|
|
|
7
|
-
from .enums import Phase, HeatIndex
|
|
8
|
-
from .constants import LATLON_REGEX
|
|
9
7
|
from .base import BaseForecast
|
|
8
|
+
from .constants import LATLON_REGEX
|
|
9
|
+
from .enums import HeatIndex, Phase
|
|
10
10
|
|
|
11
11
|
if TYPE_CHECKING:
|
|
12
12
|
from collections.abc import Iterator
|
|
@@ -29,9 +29,9 @@ class HourlyForecast(BaseForecast):
|
|
|
29
29
|
'chances_of_sunshine',
|
|
30
30
|
'chances_of_thunder',
|
|
31
31
|
'chances_of_windy',
|
|
32
|
-
'time',
|
|
33
32
|
'dew_point',
|
|
34
33
|
'heat_index',
|
|
34
|
+
'time',
|
|
35
35
|
'wind_chill',
|
|
36
36
|
'wind_gust',
|
|
37
37
|
)
|
|
@@ -122,19 +122,19 @@ class DailyForecast:
|
|
|
122
122
|
"""A weather forecast for a specific day."""
|
|
123
123
|
|
|
124
124
|
__slots__: tuple[str, ...] = (
|
|
125
|
+
'date',
|
|
126
|
+
'highest_temperature',
|
|
127
|
+
'hourly_forecasts',
|
|
128
|
+
'lowest_temperature',
|
|
125
129
|
'moon_illumination',
|
|
126
130
|
'moon_phase',
|
|
127
131
|
'moonrise',
|
|
128
132
|
'moonset',
|
|
133
|
+
'snowfall',
|
|
134
|
+
'sunlight',
|
|
129
135
|
'sunrise',
|
|
130
136
|
'sunset',
|
|
131
|
-
'date',
|
|
132
|
-
'sunlight',
|
|
133
|
-
'lowest_temperature',
|
|
134
|
-
'highest_temperature',
|
|
135
137
|
'temperature',
|
|
136
|
-
'snowfall',
|
|
137
|
-
'hourly_forecasts',
|
|
138
138
|
)
|
|
139
139
|
|
|
140
140
|
moon_illumination: int
|
|
@@ -219,13 +219,13 @@ class Forecast(BaseForecast):
|
|
|
219
219
|
"""A set of weather forecasts for a certain location."""
|
|
220
220
|
|
|
221
221
|
__slots__: tuple[str, ...] = (
|
|
222
|
-
'local_population',
|
|
223
|
-
'region',
|
|
224
|
-
'location',
|
|
225
|
-
'country',
|
|
226
|
-
'datetime',
|
|
227
222
|
'coordinates',
|
|
223
|
+
'country',
|
|
228
224
|
'daily_forecasts',
|
|
225
|
+
'datetime',
|
|
226
|
+
'local_population',
|
|
227
|
+
'location',
|
|
228
|
+
'region',
|
|
229
229
|
)
|
|
230
230
|
|
|
231
231
|
local_population: int
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-weather
|
|
3
|
-
Version: 2.2.
|
|
3
|
+
Version: 2.2.3
|
|
4
4
|
Summary: A free and asynchronous weather API wrapper made in Python, for Python.
|
|
5
5
|
Author: null8626
|
|
6
6
|
License-Expression: MIT
|
|
@@ -33,14 +33,14 @@ Classifier: Programming Language :: Python :: 3.14
|
|
|
33
33
|
Requires-Python: >=3.10
|
|
34
34
|
Description-Content-Type: text/markdown
|
|
35
35
|
License-File: LICENSE
|
|
36
|
-
Requires-Dist: aiohttp>=3.
|
|
36
|
+
Requires-Dist: aiohttp>=3.14.3
|
|
37
37
|
Provides-Extra: dev
|
|
38
38
|
Requires-Dist: mock>=5.2.0; extra == "dev"
|
|
39
|
-
Requires-Dist: pytest>=9.
|
|
40
|
-
Requires-Dist: pytest-asyncio>=1.
|
|
39
|
+
Requires-Dist: pytest>=9.1.1; extra == "dev"
|
|
40
|
+
Requires-Dist: pytest-asyncio>=1.4.0; extra == "dev"
|
|
41
41
|
Requires-Dist: pytest-cov>=7.1.0; extra == "dev"
|
|
42
42
|
Requires-Dist: multidict>=6.7.1; extra == "dev"
|
|
43
|
-
Requires-Dist: yarl>=1.
|
|
43
|
+
Requires-Dist: yarl>=1.24.5; extra == "dev"
|
|
44
44
|
Dynamic: license-file
|
|
45
45
|
|
|
46
46
|
# [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]
|
|
@@ -78,24 +78,24 @@ import asyncio
|
|
|
78
78
|
|
|
79
79
|
|
|
80
80
|
async def main() -> None:
|
|
81
|
-
|
|
81
|
+
|
|
82
82
|
# Declare the client. The measuring unit used defaults to the metric system (celcius, km/h, etc.)
|
|
83
83
|
async with python_weather.Client(unit=python_weather.IMPERIAL) as client:
|
|
84
|
-
|
|
85
84
|
# Fetch a weather forecast from a city.
|
|
86
85
|
weather = await client.get('New York')
|
|
87
|
-
|
|
86
|
+
|
|
88
87
|
# Fetch the temperature for today.
|
|
89
88
|
print(weather.temperature)
|
|
90
|
-
|
|
89
|
+
|
|
91
90
|
# Fetch weather forecast for upcoming days.
|
|
92
91
|
for daily in weather:
|
|
93
92
|
print(daily)
|
|
94
|
-
|
|
93
|
+
|
|
95
94
|
# Each daily forecast has their own hourly forecasts.
|
|
96
95
|
for hourly in daily:
|
|
97
96
|
print(f' --> {hourly!r}')
|
|
98
97
|
|
|
98
|
+
|
|
99
99
|
if __name__ == '__main__':
|
|
100
100
|
asyncio.run(main())
|
|
101
101
|
```
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|