python-weather 2.2.3__tar.gz → 2.2.5__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.
Files changed (19) hide show
  1. {python_weather-2.2.3/python_weather.egg-info → python_weather-2.2.5}/PKG-INFO +3 -2
  2. {python_weather-2.2.3 → python_weather-2.2.5}/pyproject.toml +3 -3
  3. {python_weather-2.2.3 → python_weather-2.2.5}/python_weather/__init__.py +2 -1
  4. {python_weather-2.2.3 → python_weather-2.2.5}/python_weather/base.py +1 -5
  5. {python_weather-2.2.3 → python_weather-2.2.5}/python_weather/enums.py +5 -1
  6. {python_weather-2.2.3 → python_weather-2.2.5}/python_weather/forecast.py +4 -3
  7. {python_weather-2.2.3 → python_weather-2.2.5}/python_weather/version.py +1 -1
  8. {python_weather-2.2.3 → python_weather-2.2.5/python_weather.egg-info}/PKG-INFO +3 -2
  9. {python_weather-2.2.3 → python_weather-2.2.5}/python_weather.egg-info/requires.txt +2 -1
  10. {python_weather-2.2.3 → python_weather-2.2.5}/LICENSE +0 -0
  11. {python_weather-2.2.3 → python_weather-2.2.5}/MANIFEST.in +0 -0
  12. {python_weather-2.2.3 → python_weather-2.2.5}/README.md +0 -0
  13. {python_weather-2.2.3 → python_weather-2.2.5}/python_weather/client.py +0 -0
  14. {python_weather-2.2.3 → python_weather-2.2.5}/python_weather/constants.py +0 -0
  15. {python_weather-2.2.3 → python_weather-2.2.5}/python_weather/errors.py +0 -0
  16. {python_weather-2.2.3 → python_weather-2.2.5}/python_weather.egg-info/SOURCES.txt +0 -0
  17. {python_weather-2.2.3 → python_weather-2.2.5}/python_weather.egg-info/dependency_links.txt +0 -0
  18. {python_weather-2.2.3 → python_weather-2.2.5}/python_weather.egg-info/top_level.txt +0 -0
  19. {python_weather-2.2.3 → python_weather-2.2.5}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-weather
3
- Version: 2.2.3
3
+ Version: 2.2.5
4
4
  Summary: A free and asynchronous weather API wrapper made in Python, for Python.
5
5
  Author: null8626
6
6
  License-Expression: MIT
@@ -34,12 +34,13 @@ Requires-Python: >=3.10
34
34
  Description-Content-Type: text/markdown
35
35
  License-File: LICENSE
36
36
  Requires-Dist: aiohttp>=3.14.3
37
+ Requires-Dist: babel>=2.18.0
37
38
  Provides-Extra: dev
38
39
  Requires-Dist: mock>=5.2.0; extra == "dev"
39
40
  Requires-Dist: pytest>=9.1.1; extra == "dev"
40
41
  Requires-Dist: pytest-asyncio>=1.4.0; extra == "dev"
41
42
  Requires-Dist: pytest-cov>=7.1.0; extra == "dev"
42
- Requires-Dist: multidict>=6.7.1; extra == "dev"
43
+ Requires-Dist: multidict>=6.8.0; extra == "dev"
43
44
  Requires-Dist: yarl>=1.24.5; extra == "dev"
44
45
  Dynamic: license-file
45
46
 
@@ -3,13 +3,13 @@ requires = ["setuptools"]
3
3
 
4
4
  [project]
5
5
  name = "python-weather"
6
- version = "2.2.3"
6
+ version = "2.2.5"
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.14.3"]
12
+ dependencies = ["aiohttp>=3.14.3", "babel>=2.18.0"]
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.1.1", "pytest-asyncio>=1.4.0", "pytest-cov>=7.1.0", "multidict>=6.7.1", "yarl>=1.24.5"]
38
+ dev = ["mock>=5.2.0", "pytest>=9.1.1", "pytest-asyncio>=1.4.0", "pytest-cov>=7.1.0", "multidict>=6.8.0", "yarl>=1.24.5"]
39
39
 
40
40
  [project.urls]
41
41
  Documentation = "https://python-weather.readthedocs.io/en/latest/"
@@ -2,7 +2,7 @@
2
2
  # SPDX-FileCopyrightText: 2021-2026 null8626
3
3
 
4
4
  from .client import Client
5
- from .constants import IMPERIAL, METRIC
5
+ from .constants import IMPERIAL, METRIC, _Unit
6
6
  from .enums import HeatIndex, Kind, Locale, Phase, UltraViolet, WindDirection
7
7
  from .errors import Error, RequestError
8
8
  from .forecast import Forecast
@@ -30,4 +30,5 @@ __all__ = (
30
30
  'RequestError',
31
31
  'UltraViolet',
32
32
  'WindDirection',
33
+ '_Unit',
33
34
  )
@@ -64,11 +64,7 @@ class BaseForecast:
64
64
  """The description regarding the forecast depending on the localization used."""
65
65
 
66
66
  def __init__(self, json: dict, unit: '_Unit', locale: Locale):
67
- description = (
68
- json['weatherDesc'][0]['value']
69
- if locale is Locale.ENGLISH
70
- else json[f'lang_{locale.value}'][0]['value']
71
- )
67
+ description = json.get(f'lang_{locale.value}', json['weatherDesc'])[0]['value']
72
68
 
73
69
  self.cloud_cover = int(json['cloudcover'])
74
70
  self.ultraviolet = UltraViolet._new(int(json['uvIndex']))
@@ -299,7 +299,9 @@ class Kind(BasicEnum):
299
299
 
300
300
  @classmethod
301
301
  def _missing_(cls, value: object) -> 'Kind | None':
302
- if value in (248, 260):
302
+ if value == 125:
303
+ return cls.CLOUDY
304
+ elif value in (248, 260):
303
305
  return cls.FOG
304
306
  elif value in (263, 353):
305
307
  return cls.LIGHT_SHOWERS
@@ -323,6 +325,8 @@ class Kind(BasicEnum):
323
325
  return cls.LIGHT_SNOW_SHOWERS
324
326
  elif value in (371, 395):
325
327
  return cls.HEAVY_SNOW_SHOWERS
328
+ elif value == 146:
329
+ return cls.SMOKY_HAZE
326
330
 
327
331
  @property
328
332
  def emoji(self) -> str:
@@ -4,6 +4,8 @@
4
4
  from datetime import date, datetime, time
5
5
  from typing import TYPE_CHECKING
6
6
 
7
+ from babel.dates import parse_time
8
+
7
9
  from .base import BaseForecast
8
10
  from .constants import LATLON_REGEX
9
11
  from .enums import HeatIndex, Phase
@@ -198,7 +200,7 @@ class DailyForecast:
198
200
  @staticmethod
199
201
  def __parse_time(timestamp: str) -> time | None:
200
202
  try:
201
- return datetime.strptime(timestamp, '%I:%M %p').time()
203
+ return parse_time(timestamp, locale='en_US')
202
204
  except ValueError: # pragma: nocover
203
205
  ...
204
206
 
@@ -258,8 +260,7 @@ class Forecast(BaseForecast):
258
260
  self.location = nearest['areaName'][0]['value']
259
261
  self.country = nearest['country'][0]['value']
260
262
  self.datetime = datetime.combine(
261
- datetime.today(),
262
- datetime.strptime(current['observation_time'], '%I:%M %p').time(),
263
+ datetime.today(), parse_time(current['observation_time'], locale='en_US')
263
264
  )
264
265
 
265
266
  try:
@@ -1,4 +1,4 @@
1
1
  # SPDX-License-Identifier: MIT
2
2
  # SPDX-FileCopyrightText: 2021-2026 null8626
3
3
 
4
- VERSION = '2.2.3'
4
+ VERSION = '2.2.5'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-weather
3
- Version: 2.2.3
3
+ Version: 2.2.5
4
4
  Summary: A free and asynchronous weather API wrapper made in Python, for Python.
5
5
  Author: null8626
6
6
  License-Expression: MIT
@@ -34,12 +34,13 @@ Requires-Python: >=3.10
34
34
  Description-Content-Type: text/markdown
35
35
  License-File: LICENSE
36
36
  Requires-Dist: aiohttp>=3.14.3
37
+ Requires-Dist: babel>=2.18.0
37
38
  Provides-Extra: dev
38
39
  Requires-Dist: mock>=5.2.0; extra == "dev"
39
40
  Requires-Dist: pytest>=9.1.1; extra == "dev"
40
41
  Requires-Dist: pytest-asyncio>=1.4.0; extra == "dev"
41
42
  Requires-Dist: pytest-cov>=7.1.0; extra == "dev"
42
- Requires-Dist: multidict>=6.7.1; extra == "dev"
43
+ Requires-Dist: multidict>=6.8.0; extra == "dev"
43
44
  Requires-Dist: yarl>=1.24.5; extra == "dev"
44
45
  Dynamic: license-file
45
46
 
@@ -1,9 +1,10 @@
1
1
  aiohttp>=3.14.3
2
+ babel>=2.18.0
2
3
 
3
4
  [dev]
4
5
  mock>=5.2.0
5
6
  pytest>=9.1.1
6
7
  pytest-asyncio>=1.4.0
7
8
  pytest-cov>=7.1.0
8
- multidict>=6.7.1
9
+ multidict>=6.8.0
9
10
  yarl>=1.24.5
File without changes
File without changes
File without changes