python-weather 2.2.4__py3-none-any.whl → 2.2.5__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.
@@ -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
  )
python_weather/base.py CHANGED
@@ -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']))
@@ -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:
python_weather/version.py CHANGED
@@ -1,4 +1,4 @@
1
1
  # SPDX-License-Identifier: MIT
2
2
  # SPDX-FileCopyrightText: 2021-2026 null8626
3
3
 
4
- VERSION = '2.2.4'
4
+ VERSION = '2.2.5'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-weather
3
- Version: 2.2.4
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,6 +34,7 @@ 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"
@@ -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=8JzZU2T5zKch2lP79ooBQR4aVCxpvv5k8HUeJDwQTkQ,6119
4
+ python_weather/constants.py,sha256=26-FcczVWeQ8eK_0cUXvSzQmTYsIsW4aRAVeo7g73pc,960
5
+ python_weather/enums.py,sha256=jSOl2FSi7dhKbdafg2rCJ814bX5tHshXTPr4BlXbhcw,8453
6
+ python_weather/errors.py,sha256=_B2puqZHJ8gxbnd3aRS_-YsExIf5wDLWPQKRwZxNp-I,793
7
+ python_weather/forecast.py,sha256=Nwh3e1-98IaWooV3bHkQhY_MGo39-4Q2LGzX-ClsJeM,8510
8
+ python_weather/version.py,sha256=g__VZok-Um0u5jNQ5WgZP-fLJqZYva6mvgFk7pacgmw,95
9
+ python_weather-2.2.5.dist-info/licenses/LICENSE,sha256=SDMQ_fK2dwWVC-3qqONf6VVMnBe-GtBtlfYZIN2SBXw,1080
10
+ python_weather-2.2.5.dist-info/METADATA,sha256=kd5f1nkKrbvEfNZBEs8VgWJbC5SO1gBwDWsrJyu3TzU,4291
11
+ python_weather-2.2.5.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
12
+ python_weather-2.2.5.dist-info/top_level.txt,sha256=NDqLSO3dHB1tjjiNJfEg-a9_eoOmawAZynZsy9Yu48w,15
13
+ python_weather-2.2.5.dist-info/RECORD,,
@@ -1,13 +0,0 @@
1
- python_weather/__init__.py,sha256=lgzi2izPd-IoB7COA58Qpo1kOGsKiepeye759Km1XEg,743
2
- python_weather/base.py,sha256=teq_MADdEvn39phck-WCAj-vjA_EMsUoKlnCHG0L9eg,2338
3
- python_weather/client.py,sha256=8JzZU2T5zKch2lP79ooBQR4aVCxpvv5k8HUeJDwQTkQ,6119
4
- python_weather/constants.py,sha256=26-FcczVWeQ8eK_0cUXvSzQmTYsIsW4aRAVeo7g73pc,960
5
- python_weather/enums.py,sha256=jSOl2FSi7dhKbdafg2rCJ814bX5tHshXTPr4BlXbhcw,8453
6
- python_weather/errors.py,sha256=_B2puqZHJ8gxbnd3aRS_-YsExIf5wDLWPQKRwZxNp-I,793
7
- python_weather/forecast.py,sha256=2HjSdTz37H316lEDTKDW1V7tvN1E6vxTJKUa99veRH8,8501
8
- python_weather/version.py,sha256=FDIXovX6hAHrnXtkQVpFNQ06j4mBvg0LeSSPIn1hR-o,95
9
- python_weather-2.2.4.dist-info/licenses/LICENSE,sha256=SDMQ_fK2dwWVC-3qqONf6VVMnBe-GtBtlfYZIN2SBXw,1080
10
- python_weather-2.2.4.dist-info/METADATA,sha256=8qmeu43ihjITe62s8MMTD5BOp0Zre9sSDCPEBTzP5G8,4262
11
- python_weather-2.2.4.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
12
- python_weather-2.2.4.dist-info/top_level.txt,sha256=NDqLSO3dHB1tjjiNJfEg-a9_eoOmawAZynZsy9Yu48w,15
13
- python_weather-2.2.4.dist-info/RECORD,,