pyVisualCrossing 1.0.0__tar.gz → 1.0.2__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.
@@ -0,0 +1,219 @@
1
+ Metadata-Version: 2.4
2
+ Name: pyVisualCrossing
3
+ Version: 1.0.2
4
+ Summary: Gets the weather data from Visual Crossing
5
+ Author-email: briis <bjarne@briis.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/briis/pyVisualCrossing
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Classifier: Development Status :: 4 - Beta
12
+ Requires-Python: >=3.10
13
+ Description-Content-Type: text/markdown
14
+ License-File: LICENSE
15
+ Requires-Dist: aiohttp
16
+ Dynamic: license-file
17
+
18
+ # Python Wrapper for Visual Crossing Weather API
19
+
20
+ This Python Wrapper retrives data from the [Visual Crossing](https://www.visualcrossing.com/) API. Visual Crossing has an extensive Weather API for both historical and forecast weather data, and they have a Free Tier API Key which enables up to 1000 calls per day.
21
+
22
+ In order to get started you must create an Account with Visual Crossing and then create an API Key. You do this by accessing [this website](https://www.visualcrossing.com/weather-data-editions) and clicking on the **Free** plan. Then follow the instructions to create and account and store your key in a safe place.
23
+
24
+ ## Usage
25
+
26
+ Install the module by using this command in a terminal: `pip install pyVisualCrossing`
27
+
28
+ And then see `test_module.py` for a usage example.
29
+
30
+ ## Parameters
31
+
32
+ ```python
33
+ # Initialise the module
34
+ vcapi = VisualCrossing(
35
+ api_key,
36
+ latitude,
37
+ longitude,
38
+ days=7,
39
+ language="da"
40
+ )
41
+ ```
42
+
43
+ | Parameter | Required | Default | Description |
44
+ | --------- | -------- | ------- | ----------- |
45
+ | `api_key` | Yes | `None` | This is the API Key you signed up for from Visual Crossing. See above for instructions |
46
+ | `latitude` | Yes | `None` | Latitude for the location position |
47
+ | `longitude` | Yes | `None` | Longitude for the location position |
48
+ | `days` | No | `14` | Numbers of days to retrieve forecast for. 14 days means today plus the next 14 days. On the Free plan, this is the maximum number of days |
49
+ | `language` | No | `en` | The language in which text strings should be returned. Se below for list of valid languages. |
50
+ | `session` | No | `None` | An `aiohttp.ClientSession` to reuse for the async function. If not supplied, a session is created and closed automatically. |
51
+
52
+ For an in-depth description of the Visual Crossing API, go [here](https://www.visualcrossing.com/resources/documentation/weather-api/timeline-weather-api/)
53
+
54
+ ## Fetching Data
55
+
56
+ Once initialised, call either the synchronous or the async method to retrieve data. Both return a single `ForecastData` object (or `None` if the request failed), holding the current conditions plus a daily and an hourly forecast list.
57
+
58
+ ```python
59
+ # Synchronous
60
+ data = vcapi.fetch_data()
61
+
62
+ # Async
63
+ data = await vcapi.async_fetch_data()
64
+
65
+ print(data.temperature)
66
+ for day in data.forecast_daily:
67
+ print(day.datetime, day.temperature, day.condition)
68
+
69
+ for hour in data.forecast_hourly:
70
+ print(hour.datetime, hour.temperature, hour.condition)
71
+ ```
72
+
73
+ ## Exceptions
74
+
75
+ If the API request fails, one of these exceptions (all importable from `pyVisualCrossing`) is raised:
76
+
77
+ | Exception | Description |
78
+ | --------- | ----------- |
79
+ | `VisualCrossingBadRequest` | The request was invalid (invalid dates, bad location parameter, etc.) |
80
+ | `VisualCrossingUnauthorized` | The API key is incorrect, or the account is inactive or disabled |
81
+ | `VisualCrossingTooManyRequests` | Too many daily requests for the current plan |
82
+ | `VisualCrossingInternalServerError` | Visual Crossing's servers encountered an unexpected error |
83
+ | `VisualCrossingException` | Generic base exception for failing to access the API |
84
+
85
+ ## Data
86
+
87
+ ### Current Conditions (`ForecastData`)
88
+
89
+ | Property | Description |
90
+ | -------- | ----------- |
91
+ | `datetime` | Valid time (UTC) |
92
+ | `temperature` | Air temperature |
93
+ | `apparent_temperature` | Feels-like temperature |
94
+ | `dew_point` | Dew point |
95
+ | `condition` | Weather condition text |
96
+ | `icon` | Weather condition icon id |
97
+ | `cloud_cover` | Cloud coverage (%) |
98
+ | `humidity` | Humidity (%) |
99
+ | `precipitation` | Precipitation |
100
+ | `precipitation_probability` | Probability of precipitation (%) |
101
+ | `pressure` | Sea level pressure |
102
+ | `solarradiation` | Solar radiation (W/m2) |
103
+ | `visibility` | Visibility |
104
+ | `uv_index` | UV index |
105
+ | `wind_bearing` | Wind bearing (degrees) |
106
+ | `wind_speed` | Wind speed |
107
+ | `wind_gust_speed` | Wind gust speed |
108
+ | `location_name` | Name of the location |
109
+ | `description` | Weather description |
110
+ | `snow` | Snowfall |
111
+ | `snow_depth` | Snow depth |
112
+ | `precipitation_type` | Type(s) of precipitation, if any (e.g. `rain`, `snow`) |
113
+ | `solarenergy` | Solar energy (MJ/m2) |
114
+ | `sunrise` | Sunrise time |
115
+ | `sunset` | Sunset time |
116
+ | `moon_phase` | Moon phase, as a fraction between 0 and 1 |
117
+ | `update_time` | Timestamp of when the data was fetched |
118
+ | `forecast_daily` | List of `ForecastDailyData` |
119
+ | `forecast_hourly` | List of `ForecastHourlyData` |
120
+
121
+ ### Daily Forecast (`ForecastDailyData`)
122
+
123
+ | Property | Description |
124
+ | -------- | ----------- |
125
+ | `datetime` | Valid date (UTC) |
126
+ | `temperature` | Max air temperature for the day |
127
+ | `temp_low` | Min air temperature for the day |
128
+ | `apparent_temperature` | Feels-like temperature |
129
+ | `condition` | Weather condition text |
130
+ | `icon` | Weather condition icon id |
131
+ | `cloud_cover` | Cloud coverage (%) |
132
+ | `dew_point` | Dew point |
133
+ | `humidity` | Humidity (%) |
134
+ | `precipitation` | Precipitation |
135
+ | `precipitation_probability` | Probability of precipitation (%) |
136
+ | `pressure` | Sea level pressure |
137
+ | `uv_index` | UV index |
138
+ | `wind_bearing` | Wind bearing (degrees) |
139
+ | `wind_speed` | Wind speed |
140
+ | `wind_gust` | Wind gust speed |
141
+ | `snow` | Snowfall |
142
+ | `snow_depth` | Snow depth |
143
+ | `precipitation_type` | Type(s) of precipitation, if any (e.g. `rain`, `snow`) |
144
+ | `precipitation_cover` | Percentage of the day with precipitation (%) |
145
+ | `solarradiation` | Solar radiation (W/m2) |
146
+ | `solarenergy` | Solar energy (MJ/m2) |
147
+ | `severe_risk` | Risk score of severe weather |
148
+ | `sunrise` | Sunrise time |
149
+ | `sunset` | Sunset time |
150
+ | `moon_phase` | Moon phase, as a fraction between 0 and 1 |
151
+
152
+ ### Hourly Forecast (`ForecastHourlyData`)
153
+
154
+ Only hours later than the current time are included.
155
+
156
+ | Property | Description |
157
+ | -------- | ----------- |
158
+ | `datetime` | Valid date and time (UTC) |
159
+ | `temperature` | Air temperature |
160
+ | `apparent_temperature` | Feels-like temperature |
161
+ | `condition` | Weather condition text |
162
+ | `icon` | Weather condition icon id |
163
+ | `cloud_cover` | Cloud coverage (%) |
164
+ | `dew_point` | Dew point |
165
+ | `humidity` | Humidity (%) |
166
+ | `precipitation` | Precipitation |
167
+ | `precipitation_probability` | Probability of precipitation (%) |
168
+ | `pressure` | Sea level pressure |
169
+ | `uv_index` | UV index |
170
+ | `wind_bearing` | Wind bearing (degrees) |
171
+ | `wind_speed` | Wind speed |
172
+ | `wind_gust_speed` | Wind gust speed |
173
+ | `snow` | Snowfall |
174
+ | `snow_depth` | Snow depth |
175
+ | `precipitation_type` | Type(s) of precipitation, if any (e.g. `rain`, `snow`) |
176
+ | `solarradiation` | Solar radiation (W/m2) |
177
+ | `solarenergy` | Solar energy (MJ/m2) |
178
+ | `severe_risk` | Risk score of severe weather |
179
+ | `visibility` | Visibility |
180
+
181
+ ## Languages
182
+ Available languages include: **ar** (Arabic), **bg** (Bulgiarian), **cs** (Czech), **da** (Danish), **de** (German), **el** (Greek Modern), **en** (English), **es** (Spanish), **fa** (Farsi), **fi** (Finnish), **fr** (French), **he** (Hebrew), **hu**, (Hungarian), **it** (Italian), **ja** (Japanese), **ko** (Korean), **nl** (Dutch), **pl** (Polish), **pt** (Portuguese), **sr** (Serbian), **sv** (Swedish), **tr** (Turkish), **uk** (Ukranian), **vi** (Vietnamese) and **zh** (Chinese).
183
+
184
+ ## Metrics
185
+ All records are returned using the *Metric* unit system. There is no conversion possible at the moment.
186
+
187
+ | Weather variable | Measurement Unit |
188
+ | ----------------------------------- | ------------------------ |
189
+ | Datetime | UTC datetime |
190
+ | Temperature, Heat Index & Wind Chill | Degrees Celcius |
191
+ | Precipitation | Millimeters |
192
+ | snow | Centimeters |
193
+ | Wind & Wind Gust | Kilometers Per Hour |
194
+ | Visibility | Kilometers |
195
+ | Pressure | Millibars (Hectopascals) |
196
+ | Solar Radiation | W/m2 |
197
+ | Solar Energy | MJ/m2 |
198
+
199
+ ## Icons
200
+ We use the Iconset *icons2*, which gives a more detailed description of the conditions.
201
+
202
+ | Icon id | Weather Conditions |
203
+ | -------------------- | ---------------------------- |
204
+ | snow | Amount of snow is greater than zero |
205
+ | snow-showers-day | Periods of snow during the day |
206
+ | snow-showers-night | Periods of snow during the night |
207
+ | thunder-rain | Thunderstorms throughout the day or night |
208
+ | thunder-showers-day | Possible thunderstorms throughout the day |
209
+ | thunder-showers-night | Possible thunderstorms throughout the night |
210
+ | rain | Amount of rainfall is greater than zero |
211
+ | showers-day | Rain showers during the day |
212
+ | showers-night | Rain showers during the night |
213
+ | fog | Visibility is low (lower than one kilometer or mile) |
214
+ | wind | Wind speed is high (greater than 30 kph or mph) |
215
+ | cloudy | Cloud cover is greater than 90% cover |
216
+ | partly-cloudy-day | Cloud cover is greater than 20% cover during day time. |
217
+ | partly-cloudy-night | Cloud cover is greater than 20% cover during night time. |
218
+ | clear-day | Cloud cover is less than 20% cover during day time |
219
+ | clear-night | Cloud cover is less than 20% cover during night time |
@@ -0,0 +1,202 @@
1
+ # Python Wrapper for Visual Crossing Weather API
2
+
3
+ This Python Wrapper retrives data from the [Visual Crossing](https://www.visualcrossing.com/) API. Visual Crossing has an extensive Weather API for both historical and forecast weather data, and they have a Free Tier API Key which enables up to 1000 calls per day.
4
+
5
+ In order to get started you must create an Account with Visual Crossing and then create an API Key. You do this by accessing [this website](https://www.visualcrossing.com/weather-data-editions) and clicking on the **Free** plan. Then follow the instructions to create and account and store your key in a safe place.
6
+
7
+ ## Usage
8
+
9
+ Install the module by using this command in a terminal: `pip install pyVisualCrossing`
10
+
11
+ And then see `test_module.py` for a usage example.
12
+
13
+ ## Parameters
14
+
15
+ ```python
16
+ # Initialise the module
17
+ vcapi = VisualCrossing(
18
+ api_key,
19
+ latitude,
20
+ longitude,
21
+ days=7,
22
+ language="da"
23
+ )
24
+ ```
25
+
26
+ | Parameter | Required | Default | Description |
27
+ | --------- | -------- | ------- | ----------- |
28
+ | `api_key` | Yes | `None` | This is the API Key you signed up for from Visual Crossing. See above for instructions |
29
+ | `latitude` | Yes | `None` | Latitude for the location position |
30
+ | `longitude` | Yes | `None` | Longitude for the location position |
31
+ | `days` | No | `14` | Numbers of days to retrieve forecast for. 14 days means today plus the next 14 days. On the Free plan, this is the maximum number of days |
32
+ | `language` | No | `en` | The language in which text strings should be returned. Se below for list of valid languages. |
33
+ | `session` | No | `None` | An `aiohttp.ClientSession` to reuse for the async function. If not supplied, a session is created and closed automatically. |
34
+
35
+ For an in-depth description of the Visual Crossing API, go [here](https://www.visualcrossing.com/resources/documentation/weather-api/timeline-weather-api/)
36
+
37
+ ## Fetching Data
38
+
39
+ Once initialised, call either the synchronous or the async method to retrieve data. Both return a single `ForecastData` object (or `None` if the request failed), holding the current conditions plus a daily and an hourly forecast list.
40
+
41
+ ```python
42
+ # Synchronous
43
+ data = vcapi.fetch_data()
44
+
45
+ # Async
46
+ data = await vcapi.async_fetch_data()
47
+
48
+ print(data.temperature)
49
+ for day in data.forecast_daily:
50
+ print(day.datetime, day.temperature, day.condition)
51
+
52
+ for hour in data.forecast_hourly:
53
+ print(hour.datetime, hour.temperature, hour.condition)
54
+ ```
55
+
56
+ ## Exceptions
57
+
58
+ If the API request fails, one of these exceptions (all importable from `pyVisualCrossing`) is raised:
59
+
60
+ | Exception | Description |
61
+ | --------- | ----------- |
62
+ | `VisualCrossingBadRequest` | The request was invalid (invalid dates, bad location parameter, etc.) |
63
+ | `VisualCrossingUnauthorized` | The API key is incorrect, or the account is inactive or disabled |
64
+ | `VisualCrossingTooManyRequests` | Too many daily requests for the current plan |
65
+ | `VisualCrossingInternalServerError` | Visual Crossing's servers encountered an unexpected error |
66
+ | `VisualCrossingException` | Generic base exception for failing to access the API |
67
+
68
+ ## Data
69
+
70
+ ### Current Conditions (`ForecastData`)
71
+
72
+ | Property | Description |
73
+ | -------- | ----------- |
74
+ | `datetime` | Valid time (UTC) |
75
+ | `temperature` | Air temperature |
76
+ | `apparent_temperature` | Feels-like temperature |
77
+ | `dew_point` | Dew point |
78
+ | `condition` | Weather condition text |
79
+ | `icon` | Weather condition icon id |
80
+ | `cloud_cover` | Cloud coverage (%) |
81
+ | `humidity` | Humidity (%) |
82
+ | `precipitation` | Precipitation |
83
+ | `precipitation_probability` | Probability of precipitation (%) |
84
+ | `pressure` | Sea level pressure |
85
+ | `solarradiation` | Solar radiation (W/m2) |
86
+ | `visibility` | Visibility |
87
+ | `uv_index` | UV index |
88
+ | `wind_bearing` | Wind bearing (degrees) |
89
+ | `wind_speed` | Wind speed |
90
+ | `wind_gust_speed` | Wind gust speed |
91
+ | `location_name` | Name of the location |
92
+ | `description` | Weather description |
93
+ | `snow` | Snowfall |
94
+ | `snow_depth` | Snow depth |
95
+ | `precipitation_type` | Type(s) of precipitation, if any (e.g. `rain`, `snow`) |
96
+ | `solarenergy` | Solar energy (MJ/m2) |
97
+ | `sunrise` | Sunrise time |
98
+ | `sunset` | Sunset time |
99
+ | `moon_phase` | Moon phase, as a fraction between 0 and 1 |
100
+ | `update_time` | Timestamp of when the data was fetched |
101
+ | `forecast_daily` | List of `ForecastDailyData` |
102
+ | `forecast_hourly` | List of `ForecastHourlyData` |
103
+
104
+ ### Daily Forecast (`ForecastDailyData`)
105
+
106
+ | Property | Description |
107
+ | -------- | ----------- |
108
+ | `datetime` | Valid date (UTC) |
109
+ | `temperature` | Max air temperature for the day |
110
+ | `temp_low` | Min air temperature for the day |
111
+ | `apparent_temperature` | Feels-like temperature |
112
+ | `condition` | Weather condition text |
113
+ | `icon` | Weather condition icon id |
114
+ | `cloud_cover` | Cloud coverage (%) |
115
+ | `dew_point` | Dew point |
116
+ | `humidity` | Humidity (%) |
117
+ | `precipitation` | Precipitation |
118
+ | `precipitation_probability` | Probability of precipitation (%) |
119
+ | `pressure` | Sea level pressure |
120
+ | `uv_index` | UV index |
121
+ | `wind_bearing` | Wind bearing (degrees) |
122
+ | `wind_speed` | Wind speed |
123
+ | `wind_gust` | Wind gust speed |
124
+ | `snow` | Snowfall |
125
+ | `snow_depth` | Snow depth |
126
+ | `precipitation_type` | Type(s) of precipitation, if any (e.g. `rain`, `snow`) |
127
+ | `precipitation_cover` | Percentage of the day with precipitation (%) |
128
+ | `solarradiation` | Solar radiation (W/m2) |
129
+ | `solarenergy` | Solar energy (MJ/m2) |
130
+ | `severe_risk` | Risk score of severe weather |
131
+ | `sunrise` | Sunrise time |
132
+ | `sunset` | Sunset time |
133
+ | `moon_phase` | Moon phase, as a fraction between 0 and 1 |
134
+
135
+ ### Hourly Forecast (`ForecastHourlyData`)
136
+
137
+ Only hours later than the current time are included.
138
+
139
+ | Property | Description |
140
+ | -------- | ----------- |
141
+ | `datetime` | Valid date and time (UTC) |
142
+ | `temperature` | Air temperature |
143
+ | `apparent_temperature` | Feels-like temperature |
144
+ | `condition` | Weather condition text |
145
+ | `icon` | Weather condition icon id |
146
+ | `cloud_cover` | Cloud coverage (%) |
147
+ | `dew_point` | Dew point |
148
+ | `humidity` | Humidity (%) |
149
+ | `precipitation` | Precipitation |
150
+ | `precipitation_probability` | Probability of precipitation (%) |
151
+ | `pressure` | Sea level pressure |
152
+ | `uv_index` | UV index |
153
+ | `wind_bearing` | Wind bearing (degrees) |
154
+ | `wind_speed` | Wind speed |
155
+ | `wind_gust_speed` | Wind gust speed |
156
+ | `snow` | Snowfall |
157
+ | `snow_depth` | Snow depth |
158
+ | `precipitation_type` | Type(s) of precipitation, if any (e.g. `rain`, `snow`) |
159
+ | `solarradiation` | Solar radiation (W/m2) |
160
+ | `solarenergy` | Solar energy (MJ/m2) |
161
+ | `severe_risk` | Risk score of severe weather |
162
+ | `visibility` | Visibility |
163
+
164
+ ## Languages
165
+ Available languages include: **ar** (Arabic), **bg** (Bulgiarian), **cs** (Czech), **da** (Danish), **de** (German), **el** (Greek Modern), **en** (English), **es** (Spanish), **fa** (Farsi), **fi** (Finnish), **fr** (French), **he** (Hebrew), **hu**, (Hungarian), **it** (Italian), **ja** (Japanese), **ko** (Korean), **nl** (Dutch), **pl** (Polish), **pt** (Portuguese), **sr** (Serbian), **sv** (Swedish), **tr** (Turkish), **uk** (Ukranian), **vi** (Vietnamese) and **zh** (Chinese).
166
+
167
+ ## Metrics
168
+ All records are returned using the *Metric* unit system. There is no conversion possible at the moment.
169
+
170
+ | Weather variable | Measurement Unit |
171
+ | ----------------------------------- | ------------------------ |
172
+ | Datetime | UTC datetime |
173
+ | Temperature, Heat Index & Wind Chill | Degrees Celcius |
174
+ | Precipitation | Millimeters |
175
+ | snow | Centimeters |
176
+ | Wind & Wind Gust | Kilometers Per Hour |
177
+ | Visibility | Kilometers |
178
+ | Pressure | Millibars (Hectopascals) |
179
+ | Solar Radiation | W/m2 |
180
+ | Solar Energy | MJ/m2 |
181
+
182
+ ## Icons
183
+ We use the Iconset *icons2*, which gives a more detailed description of the conditions.
184
+
185
+ | Icon id | Weather Conditions |
186
+ | -------------------- | ---------------------------- |
187
+ | snow | Amount of snow is greater than zero |
188
+ | snow-showers-day | Periods of snow during the day |
189
+ | snow-showers-night | Periods of snow during the night |
190
+ | thunder-rain | Thunderstorms throughout the day or night |
191
+ | thunder-showers-day | Possible thunderstorms throughout the day |
192
+ | thunder-showers-night | Possible thunderstorms throughout the night |
193
+ | rain | Amount of rainfall is greater than zero |
194
+ | showers-day | Rain showers during the day |
195
+ | showers-night | Rain showers during the night |
196
+ | fog | Visibility is low (lower than one kilometer or mile) |
197
+ | wind | Wind speed is high (greater than 30 kph or mph) |
198
+ | cloudy | Cloud cover is greater than 90% cover |
199
+ | partly-cloudy-day | Cloud cover is greater than 20% cover during day time. |
200
+ | partly-cloudy-night | Cloud cover is greater than 20% cover during night time. |
201
+ | clear-day | Cloud cover is less than 20% cover during day time |
202
+ | clear-night | Cloud cover is less than 20% cover during night time |
@@ -18,7 +18,7 @@ from pyVisualCrossing.data import (
18
18
  from pyVisualCrossing.const import SUPPORTED_LANGUAGES
19
19
 
20
20
  __title__ = "pyVisualCrossing"
21
- __version__ = "1.0.0"
21
+ __version__ = "1.0.2"
22
22
  __author__ = "briis"
23
23
  __license__ = "MIT"
24
24
 
@@ -234,30 +234,50 @@ def _fetch_data(api_result: dict[str, Any] | None) -> ForecastData | None:
234
234
  apparent_temperature = item.get("feelslike", None)
235
235
  precipitation = item.get("precip", None)
236
236
  precipitation_probability = item.get("precipprob", None)
237
+ precipitation_type = item.get("preciptype", None)
238
+ precipitation_cover = item.get("precipcover", None)
237
239
  humidity = item.get("humidity", None)
238
240
  pressure = item.get("pressure", None)
239
241
  uv_index = item.get("uvindex", None)
240
242
  wind_speed = item.get("windspeed", None)
241
243
  wind_gust_speed = item.get("windgust", None)
242
244
  wind_bearing = item.get("winddir", None)
245
+ snow = item.get("snow", None)
246
+ snow_depth = item.get("snowdepth", None)
247
+ solarradiation = item.get("solarradiation", None)
248
+ solarenergy = item.get("solarenergy", None)
249
+ severe_risk = item.get("severerisk", None)
250
+ sunrise = item.get("sunrise", None)
251
+ sunset = item.get("sunset", None)
252
+ moon_phase = item.get("moonphase", None)
243
253
 
244
254
  day_data = ForecastDailyData(
245
- day_obj,
246
- temperature,
247
- temp_low,
248
- apparent_temperature,
249
- condition,
250
- icon,
251
- cloudcover,
252
- dew_point,
253
- humidity,
254
- precipitation_probability,
255
- precipitation,
256
- pressure,
257
- wind_bearing,
258
- wind_speed,
259
- wind_gust_speed,
260
- uv_index,
255
+ datetime=day_obj,
256
+ temperature=temperature,
257
+ temp_low=temp_low,
258
+ apparent_temperature=apparent_temperature,
259
+ condition=condition,
260
+ icon=icon,
261
+ cloud_cover=cloudcover,
262
+ dew_point=dew_point,
263
+ humidity=humidity,
264
+ precipitation_probability=precipitation_probability,
265
+ precipitation=precipitation,
266
+ pressure=pressure,
267
+ wind_bearing=wind_bearing,
268
+ wind_speed=wind_speed,
269
+ wind_gust=wind_gust_speed,
270
+ uv_index=uv_index,
271
+ snow=snow,
272
+ snow_depth=snow_depth,
273
+ precipitation_type=precipitation_type,
274
+ precipitation_cover=precipitation_cover,
275
+ solarradiation=solarradiation,
276
+ solarenergy=solarenergy,
277
+ severe_risk=severe_risk,
278
+ sunrise=sunrise,
279
+ sunset=sunset,
280
+ moon_phase=moon_phase,
261
281
  )
262
282
  forecast_daily.append(day_data)
263
283
 
@@ -277,29 +297,43 @@ def _fetch_data(api_result: dict[str, Any] | None) -> ForecastData | None:
277
297
  apparent_temperature = row.get("feelslike", None)
278
298
  precipitation = row.get("precip", None)
279
299
  precipitation_probability = row.get("precipprob", None)
300
+ precipitation_type = row.get("preciptype", None)
280
301
  humidity = row.get("humidity", None)
281
302
  pressure = row.get("pressure", None)
282
303
  uv_index = row.get("uvindex", None)
283
304
  wind_speed = row.get("windspeed", None)
284
305
  wind_gust_speed = row.get("windgust", None)
285
306
  wind_bearing = row.get("winddir", None)
307
+ snow = row.get("snow", None)
308
+ snow_depth = row.get("snowdepth", None)
309
+ solarradiation = row.get("solarradiation", None)
310
+ solarenergy = row.get("solarenergy", None)
311
+ severe_risk = row.get("severerisk", None)
312
+ visibility = row.get("visibility", None)
286
313
 
287
314
  hour_data = ForecastHourlyData(
288
- day_hour_obj,
289
- temperature,
290
- apparent_temperature,
291
- condition,
292
- cloudcover,
293
- icon,
294
- dew_point,
295
- humidity,
296
- precipitation,
297
- precipitation_probability,
298
- pressure,
299
- wind_bearing,
300
- wind_gust_speed,
301
- wind_speed,
302
- uv_index,
315
+ datetime=day_hour_obj,
316
+ temperature=temperature,
317
+ apparent_temperature=apparent_temperature,
318
+ condition=condition,
319
+ cloud_cover=cloudcover,
320
+ icon=icon,
321
+ dew_point=dew_point,
322
+ humidity=humidity,
323
+ precipitation=precipitation,
324
+ precipitation_probability=precipitation_probability,
325
+ pressure=pressure,
326
+ wind_bearing=wind_bearing,
327
+ wind_gust_speed=wind_gust_speed,
328
+ wind_speed=wind_speed,
329
+ uv_index=uv_index,
330
+ snow=snow,
331
+ snow_depth=snow_depth,
332
+ precipitation_type=precipitation_type,
333
+ solarradiation=solarradiation,
334
+ solarenergy=solarenergy,
335
+ severe_risk=severe_risk,
336
+ visibility=visibility,
303
337
  )
304
338
  forecast_hourly.append(hour_data)
305
339
 
@@ -328,37 +362,51 @@ def _get_current_data(api_result: dict[str, Any]) -> ForecastData:
328
362
  apparent_temperature = item.get("feelslike", None)
329
363
  precipitation = item.get("precip", None)
330
364
  precipitation_probability = item.get("precipprob", None)
365
+ precipitation_type = item.get("preciptype", None)
331
366
  humidity = item.get("humidity", None)
332
367
  solarradiation = item.get("solarradiation", None)
368
+ solarenergy = item.get("solarenergy", None)
333
369
  visibility = item.get("visibility", None)
334
370
  pressure = item.get("pressure", None)
335
371
  uv_index = item.get("uvindex", None)
336
372
  wind_speed = item.get("windspeed", None)
337
373
  wind_gust_speed = item.get("windgust", None)
338
374
  wind_bearing = item.get("winddir", None)
375
+ snow = item.get("snow", None)
376
+ snow_depth = item.get("snowdepth", None)
377
+ sunrise = item.get("sunrise", None)
378
+ sunset = item.get("sunset", None)
379
+ moon_phase = item.get("moonphase", None)
339
380
  location = api_result.get("address", "")
340
381
  description = api_result.get("description", "")
341
382
 
342
383
  current_condition = ForecastData(
343
- day_hour_obj,
344
- apparent_temperature,
345
- condition,
346
- cloudcover,
347
- dew_point,
348
- humidity,
349
- icon,
350
- precipitation,
351
- precipitation_probability,
352
- pressure,
353
- solarradiation,
354
- temperature,
355
- visibility,
356
- uv_index,
357
- wind_bearing,
358
- wind_gust_speed,
359
- wind_speed,
360
- location,
361
- description,
384
+ datetime=day_hour_obj,
385
+ apparent_temperature=apparent_temperature,
386
+ condition=condition,
387
+ cloud_cover=cloudcover,
388
+ dew_point=dew_point,
389
+ humidity=humidity,
390
+ icon=icon,
391
+ precipitation=precipitation,
392
+ precipitation_probability=precipitation_probability,
393
+ pressure=pressure,
394
+ solarradiation=solarradiation,
395
+ temperature=temperature,
396
+ visibility=visibility,
397
+ uv_index=uv_index,
398
+ wind_bearing=wind_bearing,
399
+ wind_gust_speed=wind_gust_speed,
400
+ wind_speed=wind_speed,
401
+ location_name=location,
402
+ description=description,
403
+ snow=snow,
404
+ snow_depth=snow_depth,
405
+ precipitation_type=precipitation_type,
406
+ solarenergy=solarenergy,
407
+ sunrise=sunrise,
408
+ sunset=sunset,
409
+ moon_phase=moon_phase,
362
410
  )
363
411
 
364
412
  return current_condition