weathergrabber 0.0.9__py3-none-any.whl → 0.0.10__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.
@@ -4,7 +4,7 @@ from .core import main
4
4
  from .cli import main_cli
5
5
 
6
6
  __all__ = ["main", "main_cli"]
7
- __version__ = "0.0.9"
7
+ __version__ = "0.0.10"
8
8
 
9
9
  def get_version():
10
10
  return __version__
@@ -13,13 +13,9 @@ class SearchLocationService:
13
13
  if not location_name:
14
14
  self.logger.debug("No location name provided. Bypassing search.")
15
15
  return None
16
+ data = self.api.search(location_name, lang)
16
17
 
17
18
  try:
18
- data = self.api.search(location_name, lang)
19
- if not data:
20
- self.logger.error(f"No data found for location: {location_name}")
21
- raise ValueError(f"Location '{location_name}' not found.")
22
-
23
19
  dal = data["dal"]["getSunV3LocationSearchUrlConfig"]
24
20
 
25
21
  # Pick the first (arbitrary) key, then get the value
@@ -29,7 +25,7 @@ class SearchLocationService:
29
25
  self.logger.debug(f"Found location ID: {location_id} for location name: {location_name}")
30
26
 
31
27
  return location_id
32
- except Exception as e:
33
- self.logger.error(f"Error searching for location '{location_name}': {e}")
28
+ except KeyError as e:
29
+ self.logger.debug(f"Error searching for location '{location_name}': {e}")
34
30
  raise ValueError(f"Could not find location '{location_name}'.")
35
31
 
@@ -68,10 +68,10 @@ class WeatherForecastUC:
68
68
 
69
69
  try:
70
70
  location_id = self._resolve_location_id(params)
71
+ weather_data = self.read_weather_service.execute(params.language, location_id)
71
72
  except ConnectionError as e:
73
+ self.logger.debug("A connection error occurred while fetching weather data. Trying to retrieve from cache.")
72
74
  return self.retrieve_forecast_from_cache_service.execute(params)
73
-
74
- weather_data = self.read_weather_service.execute(params.language, location_id)
75
75
 
76
76
  current_conditions = self.extract_current_conditions_service.execute(weather_data)
77
77
  today_details = self.extract_today_details_service.execute(weather_data)
weathergrabber/cli.py CHANGED
@@ -16,9 +16,9 @@ def main_cli():
16
16
  parser.add_argument("--version", "-v", action='version', version=f'Weathergrabber {weathergrabber.get_version()}', help="Show version and exit")
17
17
  parser.add_argument(
18
18
  "--log",
19
- default="critical",
19
+ default="ERROR",
20
20
  choices=["debug", "info", "warning", "error", "critical", "DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"],
21
- help="Set the logging level (default: CRITICAL)"
21
+ help="Set the logging level (default: ERROR)"
22
22
  )
23
23
  args = parser.parse_args()
24
24
 
weathergrabber/core.py CHANGED
@@ -32,4 +32,12 @@ def main(log_level: str, location_name: str, location_id: str, lang: str, output
32
32
  cache_statistics=cache_statistics,
33
33
  )
34
34
 
35
- app = WeatherGrabberApplication(params)
35
+ try:
36
+ app = WeatherGrabberApplication(params)
37
+ except Exception as e:
38
+ logger = logging.getLogger()
39
+ if logger.level == logging.DEBUG:
40
+ logger.error(f"{e}", exc_info=True)
41
+ else:
42
+ logger.error(f"{e}")
43
+ raise SystemExit(1)
@@ -47,6 +47,7 @@ class WeatherIconEnum(Enum):
47
47
  # Suggestions from Copilot
48
48
  BLIZZARD = ('blizzard', '\u2744', '🌨️')
49
49
  DUST = ('dust', '\uf063', '🌪️')
50
+ BLOWING_DUST_SANDSTORM = ('blowing-dust-sandstorm', '\uf063', '🌪️')
50
51
  FLURRIES = ('flurries', '\u2744', '🌨️')
51
52
  FREEZING_DRIZZLE = ('freezing-drizzle', '\uf0e9', '🌧️')
52
53
  FREEZING_DRIZZLE_RAIN = ('freezing-drizzle-rain', '\uf0e9', '🌧️')
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: weathergrabber
3
- Version: 0.0.9
3
+ Version: 0.0.10
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
6
  License: MIT
@@ -1,7 +1,7 @@
1
- weathergrabber/__init__.py,sha256=z_8SVcvgPHVKWJg57APMX_xsh9hDcvZYhnsrGmiN9_E,216
1
+ weathergrabber/__init__.py,sha256=Va0sMEDstFkxITOxgjKch6t71YsUCU7gPI_1Pqu0Ngw,217
2
2
  weathergrabber/__main__.py,sha256=yYL-jc4kVHqaYVADzjKZfmCN2mziRofsXgnzrECbGDo,68
3
- weathergrabber/cli.py,sha256=o5CgYggCGNzLpTj8Ynuy_QqoloGYGcnPCgm9RN8iO_c,2480
4
- weathergrabber/core.py,sha256=76xkBPJluuQkhfEEWLrMp7ash03MZLnwl0kHzOKJseY,1376
3
+ weathergrabber/cli.py,sha256=oGHgkWWC3wnMDuisV2XgImQpQRHWNUL_yoqNhnJT2V4,2474
4
+ weathergrabber/core.py,sha256=ARQrqtLI-UMqJVS_T2l16dpANXLj-3bxctui2RGChpA,1618
5
5
  weathergrabber/adapter/client/weather_api.py,sha256=9S7JmXaAVvvPY60dz6rC3lx7X68BcqyvNzvSVM1-af8,963
6
6
  weathergrabber/adapter/client/weather_search_api.py,sha256=1oy7JitHcmwkkhFlD0eIt5A7a4cGbf7LMNi26tR8z5o,1724
7
7
  weathergrabber/adapter/repository/forecast_repository.py,sha256=kuQWG6e-cNzFpS7BxqbHJUKw6OLH59zYUD6sOTtEO2o,5814
@@ -23,9 +23,9 @@ weathergrabber/application/services/read_weather_service.py,sha256=7_B8E9IN1KCwO
23
23
  weathergrabber/application/services/retrieve_forecast_from_cache_service.py,sha256=7fY6pJ_2qahbFNzhnxJ7taG1cb9-ExFEV7tYnLlMCAs,1314
24
24
  weathergrabber/application/services/retrieve_statistics_service.py,sha256=XjDGbjZNlaaV1eT3hgVq_Pm012b6JHMQ66xT9DdVnPI,838
25
25
  weathergrabber/application/services/save_forecast_to_cache_service.py,sha256=a64D2_JIpFHiQodltlWJ4Us3MtTcDff_xVwSJZmwZ0c,747
26
- weathergrabber/application/services/search_location_service.py,sha256=tZmVgO45hjwoa4cl5bKPjMBmYlGxJiH_I9Ymb5pwEwU,1422
26
+ weathergrabber/application/services/search_location_service.py,sha256=8Snv8CnweRfx1LHFASgF0_N6k_tDdL7RN3zE4LDWJ64,1222
27
27
  weathergrabber/application/usecases/statistics_uc.py,sha256=ycr0dH9Ddy5S8kdzjdk5Munk01RUfY1JNPXEriH2dE0,836
28
- weathergrabber/application/usecases/weather_forecast_uc.py,sha256=zD77byoQx3YOJeKqgp1LgyRZU15OAzXfErt-7LMRqvo,6968
28
+ weathergrabber/application/usecases/weather_forecast_uc.py,sha256=PZMalRrIALLSfFOYeE26Uorud415x_J6YYZJOL-osHA,7084
29
29
  weathergrabber/domain/adapter/icon_enum.py,sha256=YxGYS5vBRV2AiAfeuPOdqaQOHixAssiMbOzQnTmdSBg,84
30
30
  weathergrabber/domain/adapter/output_enum.py,sha256=KwR3mpIrW9T3b6mV3vEHjv4ff8BAxQM-58UTtX5EVZ0,116
31
31
  weathergrabber/domain/adapter/params.py,sha256=TBhF1H2esDG16HuME43yUwm7OZivgHHnanzRpjVfj-M,2220
@@ -70,11 +70,11 @@ weathergrabber/domain/entities/temperature_hight_low.py,sha256=PQOJ5uDtfMRBR5yMx
70
70
  weathergrabber/domain/entities/timestamp.py,sha256=Bk6f8Tx0-yNitYmEKIWHnqh_ALDwxEHrhoCRSrfvYTU,1222
71
71
  weathergrabber/domain/entities/today_details.py,sha256=EUlV7xerYw5QhEsBfvO5m6-9Ghm4nPkXJz9zCmSYTbA,2398
72
72
  weathergrabber/domain/entities/uv_index.py,sha256=7XalamfjJdVSqo4x7G4JVf_HJtrPJxO1BpbvmAfBhnw,1481
73
- weathergrabber/domain/entities/weather_icon_enum.py,sha256=4mbTtZjyYaX7hNlKh1LLQdVNAEjZkmFGPijARxilZLs,4088
73
+ weathergrabber/domain/entities/weather_icon_enum.py,sha256=2JqK3MJEAdbmL_jqzJUw0V31qF9EXJFq6zF1J653eRU,4165
74
74
  weathergrabber/domain/entities/wind.py,sha256=wTDz3X1rYsnw_eNoDi1miwaomxwhiJkY_q6xrdZtLak,789
75
- weathergrabber-0.0.9.dist-info/licenses/LICENSE,sha256=X5JFljoqN43yFwpMLudQ9rtty4K_FeZfnz3v8Yhw23Q,1067
76
- weathergrabber-0.0.9.dist-info/METADATA,sha256=4FKucUYm98q6YWNOfDI3Glq990k3_XWwzNLbMwVGy6I,7473
77
- weathergrabber-0.0.9.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
78
- weathergrabber-0.0.9.dist-info/entry_points.txt,sha256=m2P9a4mrJDTzuNaiTU438NA60GxCfaw7VKvruWw43N8,63
79
- weathergrabber-0.0.9.dist-info/top_level.txt,sha256=P3NMDJJYRIvQujf994Vb4gZrobkKWkL2gh3NF_ajQWM,15
80
- weathergrabber-0.0.9.dist-info/RECORD,,
75
+ weathergrabber-0.0.10.dist-info/licenses/LICENSE,sha256=X5JFljoqN43yFwpMLudQ9rtty4K_FeZfnz3v8Yhw23Q,1067
76
+ weathergrabber-0.0.10.dist-info/METADATA,sha256=jUtmerghLvf8yOG2qKbenOOIRrq8keEidosBoy1JERA,7474
77
+ weathergrabber-0.0.10.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
78
+ weathergrabber-0.0.10.dist-info/entry_points.txt,sha256=m2P9a4mrJDTzuNaiTU438NA60GxCfaw7VKvruWw43N8,63
79
+ weathergrabber-0.0.10.dist-info/top_level.txt,sha256=P3NMDJJYRIvQujf994Vb4gZrobkKWkL2gh3NF_ajQWM,15
80
+ weathergrabber-0.0.10.dist-info/RECORD,,