python-weather 2.0.2__tar.gz → 2.0.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-weather
3
- Version: 2.0.2
3
+ Version: 2.0.3
4
4
  Summary: A free and asynchronous weather API wrapper made in Python, for Python.
5
5
  Author: null8626
6
6
  License: MIT
@@ -3,7 +3,7 @@ requires = ["setuptools"]
3
3
 
4
4
  [project]
5
5
  name = "python-weather"
6
- version = "2.0.2"
6
+ version = "2.0.3"
7
7
  description = "A free and asynchronous weather API wrapper made in Python, for Python."
8
8
  readme = "README.md"
9
9
  license = { text = "MIT" }
@@ -8,7 +8,7 @@ from .errors import Error
8
8
  __title__ = 'python-weather'
9
9
  __author__ = 'null8626'
10
10
  __license__ = 'MIT'
11
- __version__ = '2.0.2'
11
+ __version__ = '2.0.3'
12
12
  __all__ = (
13
13
  'METRIC',
14
14
  'IMPERIAL',
@@ -79,23 +79,20 @@ class Client(CustomizableBase):
79
79
  locale = self._CustomizableBase__locale
80
80
 
81
81
  subdomain = f'{locale.value}.' if locale != Locale.ENGLISH else ''
82
- delay = 0
82
+ delay = 0.5
83
83
 
84
84
  while True:
85
- if delay != 0:
86
- await sleep(delay)
87
- delay *= 2
88
-
89
85
  async with self.__session.get(
90
86
  f'https://{subdomain}wttr.in/{quote_plus(location)}?format=j1'
91
87
  ) as resp:
92
88
  try:
93
89
  return Forecast(await resp.json(), unit, locale)
94
90
  except Exception as e:
95
- if delay == 4:
91
+ if delay == 2:
96
92
  raise e # okay, that's too much requests - just raise the error
97
- elif delay == 0:
98
- delay = 0.5
93
+
94
+ await sleep(delay)
95
+ delay *= 2
99
96
 
100
97
  async def close(self):
101
98
  """Closes the :class:`Client` object. Nothing will happen if it's already closed."""
@@ -35,5 +35,5 @@ class _Unit:
35
35
  METRIC = _Unit('C', 'Kmph', '', 'MM', '', 1)
36
36
  IMPERIAL = _Unit('F', 'Miles', 'Inches', 'Inches', 'Miles', 2.54)
37
37
 
38
- WIND_DIRECTION_EMOJIS = ['↓', '↙', '←', '↖', '↑', '↗', '→', '↘']
38
+ WIND_DIRECTION_EMOJIS = ('↓', '↙', '←', '↖', '↑', '↗', '→', '↘')
39
39
  LATLON_REGEX = compile(r'^Lat (\-?[\d\.]+) and Lon (\-?[\d\.]+)$')
@@ -402,7 +402,7 @@ class Phase(BasicEnum):
402
402
  return '🌒'
403
403
  elif self is self.FIRST_QUARTER:
404
404
  return '🌓'
405
- elif self is self.Waxing_GIBBOUS:
405
+ elif self is self.WAXING_GIBBOUS:
406
406
  return '🌔'
407
407
  elif self is self.FULL_MOON:
408
408
  return '🌕'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-weather
3
- Version: 2.0.2
3
+ Version: 2.0.3
4
4
  Summary: A free and asynchronous weather API wrapper made in Python, for Python.
5
5
  Author: null8626
6
6
  License: MIT
File without changes
File without changes
File without changes