weathergrabber 0.0.6__tar.gz → 0.0.7a2__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 (80) hide show
  1. {weathergrabber-0.0.6/weathergrabber.egg-info → weathergrabber-0.0.7a2}/PKG-INFO +20 -6
  2. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/README.md +18 -4
  3. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/pyproject.toml +2 -2
  4. weathergrabber-0.0.7a2/weathergrabber/__init__.py +7 -0
  5. weathergrabber-0.0.7a2/weathergrabber/__main__.py +4 -0
  6. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/weathergrabber/cli.py +1 -1
  7. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/weathergrabber/domain/timestamp.py +4 -1
  8. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/weathergrabber/domain/weather_icon_enum.py +6 -2
  9. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/weathergrabber/usecase/use_case.py +2 -0
  10. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2/weathergrabber.egg-info}/PKG-INFO +20 -6
  11. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/weathergrabber.egg-info/SOURCES.txt +1 -0
  12. weathergrabber-0.0.6/weathergrabber/__init__.py +0 -0
  13. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/LICENSE +0 -0
  14. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/setup.cfg +0 -0
  15. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/tests/test_cli.py +0 -0
  16. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/tests/test_core.py +0 -0
  17. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/weathergrabber/adapter/client/weather_api.py +0 -0
  18. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/weathergrabber/adapter/client/weather_search_api.py +0 -0
  19. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/weathergrabber/adapter/tty/console_tty.py +0 -0
  20. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/weathergrabber/adapter/tty/json_tty.py +0 -0
  21. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/weathergrabber/adapter/tty/waybar_tty.py +0 -0
  22. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/weathergrabber/core.py +0 -0
  23. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/weathergrabber/domain/adapter/icon_enum.py +0 -0
  24. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/weathergrabber/domain/adapter/mapper/air_quality_index_mapper.py +0 -0
  25. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/weathergrabber/domain/adapter/mapper/city_location_mapper.py +0 -0
  26. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/weathergrabber/domain/adapter/mapper/color_mapper.py +0 -0
  27. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/weathergrabber/domain/adapter/mapper/current_conditions_mapper.py +0 -0
  28. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/weathergrabber/domain/adapter/mapper/daily_predictions_mapper.py +0 -0
  29. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/weathergrabber/domain/adapter/mapper/day_night_mapper.py +0 -0
  30. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/weathergrabber/domain/adapter/mapper/forecast_mapper.py +0 -0
  31. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/weathergrabber/domain/adapter/mapper/health_activities_mapper.py +0 -0
  32. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/weathergrabber/domain/adapter/mapper/hourly_predictions_mapper.py +0 -0
  33. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/weathergrabber/domain/adapter/mapper/label_value_mapper.py +0 -0
  34. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/weathergrabber/domain/adapter/mapper/moon_phase_mapper.py +0 -0
  35. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/weathergrabber/domain/adapter/mapper/precipitation_mapper.py +0 -0
  36. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/weathergrabber/domain/adapter/mapper/search_mapper.py +0 -0
  37. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/weathergrabber/domain/adapter/mapper/sunrise_sunset_mapper.py +0 -0
  38. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/weathergrabber/domain/adapter/mapper/temperature_high_low_mapper.py +0 -0
  39. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/weathergrabber/domain/adapter/mapper/timestamp_mapper.py +0 -0
  40. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/weathergrabber/domain/adapter/mapper/today_details_mapper.py +0 -0
  41. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/weathergrabber/domain/adapter/mapper/uv_index_mapper.py +0 -0
  42. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/weathergrabber/domain/adapter/mapper/weather_icon_enum_mapper.py +0 -0
  43. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/weathergrabber/domain/adapter/mapper/wind_mapper.py +0 -0
  44. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/weathergrabber/domain/adapter/output_enum.py +0 -0
  45. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/weathergrabber/domain/adapter/params.py +0 -0
  46. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/weathergrabber/domain/air_quality_index.py +0 -0
  47. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/weathergrabber/domain/city_location.py +0 -0
  48. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/weathergrabber/domain/color.py +0 -0
  49. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/weathergrabber/domain/current_conditions.py +0 -0
  50. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/weathergrabber/domain/daily_predictions.py +0 -0
  51. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/weathergrabber/domain/day_night.py +0 -0
  52. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/weathergrabber/domain/forecast.py +0 -0
  53. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/weathergrabber/domain/health_activities.py +0 -0
  54. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/weathergrabber/domain/hourly_predictions.py +0 -0
  55. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/weathergrabber/domain/label_value.py +0 -0
  56. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/weathergrabber/domain/moon_phase.py +0 -0
  57. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/weathergrabber/domain/moon_phase_enum.py +0 -0
  58. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/weathergrabber/domain/precipitation.py +0 -0
  59. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/weathergrabber/domain/search.py +0 -0
  60. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/weathergrabber/domain/sunrise_sunset.py +0 -0
  61. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/weathergrabber/domain/temperature_hight_low.py +0 -0
  62. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/weathergrabber/domain/today_details.py +0 -0
  63. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/weathergrabber/domain/uv_index.py +0 -0
  64. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/weathergrabber/domain/wind.py +0 -0
  65. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/weathergrabber/service/extract_aqi_service.py +0 -0
  66. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/weathergrabber/service/extract_current_conditions_service.py +0 -0
  67. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/weathergrabber/service/extract_daily_forecast_oldstyle_service.py +0 -0
  68. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/weathergrabber/service/extract_daily_forecast_service.py +0 -0
  69. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/weathergrabber/service/extract_health_activities_service.py +0 -0
  70. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/weathergrabber/service/extract_hourly_forecast_oldstyle_service.py +0 -0
  71. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/weathergrabber/service/extract_hourly_forecast_service.py +0 -0
  72. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/weathergrabber/service/extract_temperature_service.py +0 -0
  73. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/weathergrabber/service/extract_today_details_service.py +0 -0
  74. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/weathergrabber/service/read_weather_service.py +0 -0
  75. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/weathergrabber/service/search_location_service.py +0 -0
  76. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/weathergrabber/weathergrabber_application.py +0 -0
  77. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/weathergrabber.egg-info/dependency_links.txt +0 -0
  78. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/weathergrabber.egg-info/entry_points.txt +0 -0
  79. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/weathergrabber.egg-info/requires.txt +0 -0
  80. {weathergrabber-0.0.6 → weathergrabber-0.0.7a2}/weathergrabber.egg-info/top_level.txt +0 -0
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: weathergrabber
3
- Version: 0.0.6
3
+ Version: 0.0.7a2
4
4
  Summary: A grabber for weather.com data with various output formats.
5
5
  Author-email: Carlos Anselmo Mendes Junior <cjuniorfox@gmail.com>
6
- License: MIT
6
+ License-Expression: MIT
7
7
  Project-URL: homepage, https://github.com/cjuniorfox/weather
8
8
  Project-URL: repository, https://github.com/cjuniorfox/weather
9
9
  Requires-Python: >=3.12
@@ -140,7 +140,21 @@ weathergrabber [location_name] [options]
140
140
  Or as a Python module:
141
141
 
142
142
  ```sh
143
- python -m weathergrabber.cli [location_name] [options]
143
+ python -m weathergrabber [location_name] [options]
144
+ ```
145
+
146
+ ### Importing as a Python module
147
+
148
+ You can also use the main API or CLI entry point in your own Python code:
149
+
150
+ ```python
151
+ import weathergrabber
152
+
153
+ # Call the main API
154
+ weathergrabber.main(log_level="INFO", location_name="London", location_id="", lang="en-GB", output="console", keep_open=False, icons="emoji")
155
+
156
+ # Or run the CLI programmatically
157
+ weathergrabber.main_cli()
144
158
  ```
145
159
 
146
160
  ### Arguments
@@ -172,7 +186,7 @@ weathergrabber "Paris" -o waybar -i fa
172
186
  Or as a Python module:
173
187
 
174
188
  ```sh
175
- python -m weathergrabber.cli "London" --output console --lang en-GB
176
- python -m weathergrabber.cli --location-id 1234567890abcdef... --output json
177
- python -m weathergrabber.cli "Paris" -o waybar -i fa
189
+ python -m weathergrabber "London" --output console --lang en-GB
190
+ python -m weathergrabber --location-id 1234567890abcdef... --output json
191
+ python -m weathergrabber "Paris" -o waybar -i fa
178
192
  ```
@@ -125,7 +125,21 @@ weathergrabber [location_name] [options]
125
125
  Or as a Python module:
126
126
 
127
127
  ```sh
128
- python -m weathergrabber.cli [location_name] [options]
128
+ python -m weathergrabber [location_name] [options]
129
+ ```
130
+
131
+ ### Importing as a Python module
132
+
133
+ You can also use the main API or CLI entry point in your own Python code:
134
+
135
+ ```python
136
+ import weathergrabber
137
+
138
+ # Call the main API
139
+ weathergrabber.main(log_level="INFO", location_name="London", location_id="", lang="en-GB", output="console", keep_open=False, icons="emoji")
140
+
141
+ # Or run the CLI programmatically
142
+ weathergrabber.main_cli()
129
143
  ```
130
144
 
131
145
  ### Arguments
@@ -157,7 +171,7 @@ weathergrabber "Paris" -o waybar -i fa
157
171
  Or as a Python module:
158
172
 
159
173
  ```sh
160
- python -m weathergrabber.cli "London" --output console --lang en-GB
161
- python -m weathergrabber.cli --location-id 1234567890abcdef... --output json
162
- python -m weathergrabber.cli "Paris" -o waybar -i fa
174
+ python -m weathergrabber "London" --output console --lang en-GB
175
+ python -m weathergrabber --location-id 1234567890abcdef... --output json
176
+ python -m weathergrabber "Paris" -o waybar -i fa
163
177
  ```
@@ -1,10 +1,10 @@
1
1
  [project]
2
2
  name = "weathergrabber"
3
- version = "0.0.6"
3
+ version = "0.0.7a2"
4
4
  description = "A grabber for weather.com data with various output formats."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.12"
7
- license = { text = "MIT" }
7
+ license = "MIT"
8
8
  authors = [
9
9
  { name = "Carlos Anselmo Mendes Junior", email = "cjuniorfox@gmail.com" }
10
10
  ]
@@ -0,0 +1,7 @@
1
+ """weathergrabber - Python interface and CLI for weather.com data."""
2
+
3
+ from .core import main
4
+ from .cli import main_cli
5
+
6
+ __all__ = ["main", "main_cli"]
7
+ __version__ = "0.1.0"
@@ -0,0 +1,4 @@
1
+ """weathergrabber CLI entry point."""
2
+ from .cli import main_cli
3
+ if __name__ == "__main__":
4
+ main_cli()
@@ -1,6 +1,6 @@
1
1
  import argparse
2
2
  import os
3
- from .core import main
3
+ from weathergrabber import main
4
4
 
5
5
  def main_cli():
6
6
  ## Get current locale, or use the default one
@@ -30,9 +30,12 @@ class Timestamp:
30
30
  @classmethod
31
31
  def from_string(cls, text) -> "Timestamp":
32
32
  # "As of 4:23 pm GMT-03:00",
33
+ # "As of 4:23 pm EDT",
33
34
  # "As of 16:37 GMT-03:00",
34
35
  # "Até 16:38 GMT-03:00"
35
- pattern = re.compile(r'(\d{1,2}:\d{2}(?: ?[ap]m)?)\s+(GMT[+-]\d{2}:\d{2})')
36
+ # "Até 20:44 EDT"
37
+ # Simplified: just match time (with optional am/pm) and timezone (GMT offset or abbreviation)
38
+ pattern = re.compile(r'(\d{1,2}:\d{2}(?: ?[ap]m)?)\s*((?:GMT[+-]\d{2}:\d{2})|[A-Z]{2,4})', re.IGNORECASE)
36
39
  match = pattern.search(text)
37
40
  if match:
38
41
  time, gmt = match.groups()
@@ -7,6 +7,7 @@ class WeatherIconEnum(Enum):
7
7
  CLOUDY_FOGGY_DAY = ('cloudy-foggy-day', chr(0xF013), '🌥️')
8
8
  CLOUDY_FOGGY_NIGHT = ('cloudy-foggy-night', chr(0xF013), '🌥️')
9
9
  DAY = ('day', '\uf185', '🌞')
10
+ DRIZZLE = ('drizzle', '\uf0e9', '🌦️')
10
11
  FEEL = ('feel', '\uf2c9', '🥵')
11
12
  FOGGY = ('foggy', '\uf74e', '🌫️')
12
13
  HUMIDITY = ('humidity', '\uf043', '💧')
@@ -22,6 +23,8 @@ class WeatherIconEnum(Enum):
22
23
  RAINY_NIGHT = ('rainy-night', chr(0x1F326), '🌧️')
23
24
  SCATTERED_SHOWERS_DAY = ('scattered-showers-day', chr(0x1F326), '🌦️')
24
25
  SCATTERED_SHOWERS_NIGHT = ('scattered-showers-night', chr(0x1F326), '🌦️')
26
+ SCATTERED_THUNDERSTORMS_DAY = ('scattered-thunderstorms-day', chr(0x26C8), '⛈️')
27
+ SCATTERED_THUNDERSTORMS_NIGHT = ('scattered-thunderstorms-night', chr(0x26C8), '⛈️')
25
28
  SEVERE = ('severe', '\ue317', '🌩️')
26
29
  SHOWERS = ('showers', '\u26c6', '🌧️')
27
30
  SNOW = ('snow', '\uf2dc', '❄️')
@@ -30,9 +33,10 @@ class WeatherIconEnum(Enum):
30
33
  SUNNY = ('sunny', chr(0xF0599), '☀️')
31
34
  SUNRISE = ('sunrise', '\ue34c', '🌅')
32
35
  SUNSET = ('sunset', '\ue34d', '🌇')
33
- THUNDERSTORM = ('thunderstorm', '\uf0e7', '⛈️')
36
+ THUNDERSTORMS = ('thunderstorms', '\uf0e7', '⛈️')
34
37
  VISIBILITY = ('visibility', '\uf06e', '👁️')
35
38
  WIND = ('wind', chr(0xf059d), '🌪️')
39
+ WINDY = ('windy', chr(0xf059d), '🌪️')
36
40
 
37
41
  def __init__(self, name: str, fa_icon: str, emoji_icon: str):
38
42
  self._name = name
@@ -56,4 +60,4 @@ class WeatherIconEnum(Enum):
56
60
  for item in WeatherIconEnum:
57
61
  if item._name == name:
58
62
  return item
59
- return None
63
+ raise ValueError(f'WeatherIconEnum: No icon found for name "{name}"')
@@ -59,11 +59,13 @@ class UseCase:
59
59
  try:
60
60
  hourly_predictions = self.extract_hourly_forecast_service.execute(weather_data)
61
61
  except ValueError:
62
+ self.logger.warning("Falling back to old style hourly forecast extraction")
62
63
  hourly_predictions = self.extract_hourly_forecast_oldstyle_service.execute(weather_data)
63
64
 
64
65
  try:
65
66
  daily_predictions = self.extract_daily_forecast_service.execute(weather_data)
66
67
  except ValueError:
68
+ self.logger.warning("Falling back to old style daily forecast extraction")
67
69
  daily_predictions = self.extract_daily_forecast_oldstyle_service.execute(weather_data)
68
70
 
69
71
  forecast = Forecast(
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: weathergrabber
3
- Version: 0.0.6
3
+ Version: 0.0.7a2
4
4
  Summary: A grabber for weather.com data with various output formats.
5
5
  Author-email: Carlos Anselmo Mendes Junior <cjuniorfox@gmail.com>
6
- License: MIT
6
+ License-Expression: MIT
7
7
  Project-URL: homepage, https://github.com/cjuniorfox/weather
8
8
  Project-URL: repository, https://github.com/cjuniorfox/weather
9
9
  Requires-Python: >=3.12
@@ -140,7 +140,21 @@ weathergrabber [location_name] [options]
140
140
  Or as a Python module:
141
141
 
142
142
  ```sh
143
- python -m weathergrabber.cli [location_name] [options]
143
+ python -m weathergrabber [location_name] [options]
144
+ ```
145
+
146
+ ### Importing as a Python module
147
+
148
+ You can also use the main API or CLI entry point in your own Python code:
149
+
150
+ ```python
151
+ import weathergrabber
152
+
153
+ # Call the main API
154
+ weathergrabber.main(log_level="INFO", location_name="London", location_id="", lang="en-GB", output="console", keep_open=False, icons="emoji")
155
+
156
+ # Or run the CLI programmatically
157
+ weathergrabber.main_cli()
144
158
  ```
145
159
 
146
160
  ### Arguments
@@ -172,7 +186,7 @@ weathergrabber "Paris" -o waybar -i fa
172
186
  Or as a Python module:
173
187
 
174
188
  ```sh
175
- python -m weathergrabber.cli "London" --output console --lang en-GB
176
- python -m weathergrabber.cli --location-id 1234567890abcdef... --output json
177
- python -m weathergrabber.cli "Paris" -o waybar -i fa
189
+ python -m weathergrabber "London" --output console --lang en-GB
190
+ python -m weathergrabber --location-id 1234567890abcdef... --output json
191
+ python -m weathergrabber "Paris" -o waybar -i fa
178
192
  ```
@@ -4,6 +4,7 @@ pyproject.toml
4
4
  tests/test_cli.py
5
5
  tests/test_core.py
6
6
  weathergrabber/__init__.py
7
+ weathergrabber/__main__.py
7
8
  weathergrabber/cli.py
8
9
  weathergrabber/core.py
9
10
  weathergrabber/weathergrabber_application.py
File without changes
File without changes