weathergrabber 0.0.10__tar.gz → 0.0.11__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.
- {weathergrabber-0.0.10/weathergrabber.egg-info → weathergrabber-0.0.11}/PKG-INFO +1 -1
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/pyproject.toml +1 -1
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/__init__.py +1 -1
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/application/services/extract_current_conditions_service.py +15 -3
- {weathergrabber-0.0.10 → weathergrabber-0.0.11/weathergrabber.egg-info}/PKG-INFO +1 -1
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/LICENSE +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/README.md +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/setup.cfg +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/tests/test_cli.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/tests/test_cli_version.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/tests/test_core.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/tests/test_main.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/__main__.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/adapter/client/weather_api.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/adapter/client/weather_search_api.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/adapter/repository/forecast_repository.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/adapter/tty/console_tty.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/adapter/tty/json_tty.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/adapter/tty/statistics_tty.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/adapter/tty/waybar_tty.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/application/services/extract_aqi_service.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/application/services/extract_daily_forecast_oldstyle_service.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/application/services/extract_daily_forecast_service.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/application/services/extract_health_activities_service.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/application/services/extract_hourly_forecast_oldstyle_service.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/application/services/extract_hourly_forecast_service.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/application/services/extract_temperature_service.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/application/services/extract_today_details_service.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/application/services/read_weather_service.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/application/services/retrieve_forecast_from_cache_service.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/application/services/retrieve_statistics_service.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/application/services/save_forecast_to_cache_service.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/application/services/search_location_service.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/application/usecases/statistics_uc.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/application/usecases/weather_forecast_uc.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/application/weathergrabber_application.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/cli.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/core.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/domain/adapter/icon_enum.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/domain/adapter/mappers/air_quality_index_mapper.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/domain/adapter/mappers/city_location_mapper.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/domain/adapter/mappers/color_mapper.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/domain/adapter/mappers/current_conditions_mapper.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/domain/adapter/mappers/daily_predictions_mapper.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/domain/adapter/mappers/day_night_mapper.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/domain/adapter/mappers/forecast_mapper.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/domain/adapter/mappers/health_activities_mapper.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/domain/adapter/mappers/hourly_predictions_mapper.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/domain/adapter/mappers/label_value_mapper.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/domain/adapter/mappers/moon_phase_mapper.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/domain/adapter/mappers/precipitation_mapper.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/domain/adapter/mappers/search_mapper.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/domain/adapter/mappers/statistics_mapper.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/domain/adapter/mappers/sunrise_sunset_mapper.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/domain/adapter/mappers/temperature_high_low_mapper.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/domain/adapter/mappers/timestamp_mapper.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/domain/adapter/mappers/today_details_mapper.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/domain/adapter/mappers/uv_index_mapper.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/domain/adapter/mappers/weather_icon_enum_mapper.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/domain/adapter/mappers/wind_mapper.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/domain/adapter/output_enum.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/domain/adapter/params.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/domain/entities/air_quality_index.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/domain/entities/city_location.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/domain/entities/color.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/domain/entities/current_conditions.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/domain/entities/daily_predictions.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/domain/entities/day_night.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/domain/entities/forecast.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/domain/entities/health_activities.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/domain/entities/hourly_predictions.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/domain/entities/label_value.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/domain/entities/moon_phase.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/domain/entities/moon_phase_enum.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/domain/entities/precipitation.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/domain/entities/search.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/domain/entities/statistics.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/domain/entities/sunrise_sunset.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/domain/entities/temperature_hight_low.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/domain/entities/timestamp.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/domain/entities/today_details.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/domain/entities/uv_index.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/domain/entities/weather_icon_enum.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/domain/entities/wind.py +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber.egg-info/SOURCES.txt +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber.egg-info/dependency_links.txt +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber.egg-info/entry_points.txt +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber.egg-info/requires.txt +0 -0
- {weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber.egg-info/top_level.txt +0 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import logging
|
|
2
|
+
import json
|
|
2
3
|
from pyquery import PyQuery
|
|
3
4
|
from weathergrabber.domain.entities.weather_icon_enum import WeatherIconEnum
|
|
4
5
|
from weathergrabber.domain.entities.city_location import CityLocation
|
|
@@ -16,12 +17,12 @@ class ExtractCurrentConditionsService:
|
|
|
16
17
|
|
|
17
18
|
data = PyQuery(weather_data('div[data-testid="CurrentConditionsContainer"]'))
|
|
18
19
|
|
|
19
|
-
|
|
20
|
+
|
|
20
21
|
timestamp_data = data.find('span[class*="timestamp"]').text() # 'As of 8:01 pm GMT-03:00'
|
|
21
22
|
icon_data = data.find('svg[class*="wxIcon"]').attr('name') # 'partly-cloudy-night'
|
|
22
23
|
temp_day_night = data.find('div[class*="tempHiLoValue"]').text() #'Day\xa063°\xa0•\xa0Night\xa046°'
|
|
23
24
|
|
|
24
|
-
city_location =
|
|
25
|
+
city_location = self.__location(weather_data)
|
|
25
26
|
timestamp = Timestamp.from_string(timestamp_data)
|
|
26
27
|
temperature = data.find('span[class*="tempValue"]').text() # '48°'
|
|
27
28
|
icon = WeatherIconEnum.from_name(icon_data)
|
|
@@ -39,4 +40,15 @@ class ExtractCurrentConditionsService:
|
|
|
39
40
|
|
|
40
41
|
self.logger.debug(f"Extracted current conditions: {current_conditions}")
|
|
41
42
|
|
|
42
|
-
return current_conditions
|
|
43
|
+
return current_conditions
|
|
44
|
+
|
|
45
|
+
def __location(self, weather_data: PyQuery) -> CityLocation:
|
|
46
|
+
location_str = weather_data.find('script[type="application/ld+json"]').contents().eq(2).text()
|
|
47
|
+
location_data = json.loads(location_str)
|
|
48
|
+
address = location_data.get("address", {})
|
|
49
|
+
|
|
50
|
+
return CityLocation(
|
|
51
|
+
city=address.get("addressLocality"),
|
|
52
|
+
state_province=address.get("addressRegion"),
|
|
53
|
+
country=address.get("addressCountry")
|
|
54
|
+
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/adapter/client/weather_api.py
RENAMED
|
File without changes
|
{weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/adapter/client/weather_search_api.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/adapter/tty/statistics_tty.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/application/usecases/statistics_uc.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/domain/adapter/mappers/wind_mapper.py
RENAMED
|
File without changes
|
{weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/domain/adapter/output_enum.py
RENAMED
|
File without changes
|
|
File without changes
|
{weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/domain/entities/air_quality_index.py
RENAMED
|
File without changes
|
{weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/domain/entities/city_location.py
RENAMED
|
File without changes
|
|
File without changes
|
{weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/domain/entities/current_conditions.py
RENAMED
|
File without changes
|
{weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/domain/entities/daily_predictions.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/domain/entities/health_activities.py
RENAMED
|
File without changes
|
{weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/domain/entities/hourly_predictions.py
RENAMED
|
File without changes
|
{weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/domain/entities/label_value.py
RENAMED
|
File without changes
|
{weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/domain/entities/moon_phase.py
RENAMED
|
File without changes
|
{weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/domain/entities/moon_phase_enum.py
RENAMED
|
File without changes
|
{weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/domain/entities/precipitation.py
RENAMED
|
File without changes
|
|
File without changes
|
{weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/domain/entities/statistics.py
RENAMED
|
File without changes
|
{weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/domain/entities/sunrise_sunset.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/domain/entities/today_details.py
RENAMED
|
File without changes
|
|
File without changes
|
{weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber/domain/entities/weather_icon_enum.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{weathergrabber-0.0.10 → weathergrabber-0.0.11}/weathergrabber.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|