hamsclientfork 0.2.17__tar.gz → 0.2.19__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: hamsclientfork
3
- Version: 0.2.17
3
+ Version: 0.2.19
4
4
  Summary: Library to get data from meteo swiss
5
5
  Home-page: https://github.com/Rudd-O/hamsclientfork
6
6
  Author: websylv
@@ -29,7 +29,7 @@ _HEADERS = {
29
29
  }
30
30
 
31
31
  MS_BASE_URL = "https://www.meteosuisse.admin.ch"
32
- JSON_FORECAST_URL = "https://app-prod-ws.meteoswiss-app.ch/v1/forecast?plz={}00&graph_startLowResolution=true&warning=true"
32
+ JSON_FORECAST_URL = "https://app-prod-ws.meteoswiss-app.ch/v2/forecast?plz={}00&graph_startLowResolution=true&warning=true"
33
33
  MS_SEARCH_URL = "https://www.meteosuisse.admin.ch/home/actualite/infos.html?ort={}&pageIndex=0&tab=search_tab"
34
34
  CURRENT_CONDITION_URL = (
35
35
  "https://data.geo.admin.ch/ch.meteoschweiz.messwerte-aktuell/VQHA80.csv"
@@ -192,7 +192,7 @@ def CurrentCondition_from_meteoswiss_data(data: dict[str, Any]) -> CurrentCondit
192
192
 
193
193
  class ClientResult(TypedDict):
194
194
  name: str
195
- forecast: Forecast
195
+ forecast: Forecast | None
196
196
  # A list of current conditions for the first station passed.
197
197
  condition: list[CurrentCondition]
198
198
  # A dictionary of station -> list of the current precipitation
@@ -201,9 +201,13 @@ class ClientResult(TypedDict):
201
201
 
202
202
 
203
203
  def ClientResult_from_meteoswiss_data(data: dict[str, Any]) -> ClientResult:
204
+ if not data["forecast"].get("plz"): # PLZ came back as zero or None, no forecast
205
+ forecast = None
206
+ else:
207
+ forecast = Forecast_from_meteoswiss_data(data["forecast"])
204
208
  return ClientResult(
205
209
  name=data["name"],
206
- forecast=Forecast_from_meteoswiss_data(data["forecast"]),
210
+ forecast=forecast,
207
211
  condition=[CurrentCondition_from_meteoswiss_data(x) for x in data["condition"]],
208
212
  condition_by_station={
209
213
  station: CurrentCondition_from_meteoswiss_data(condition)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: hamsclientfork
3
- Version: 0.2.17
3
+ Version: 0.2.19
4
4
  Summary: Library to get data from meteo swiss
5
5
  Home-page: https://github.com/Rudd-O/hamsclientfork
6
6
  Author: websylv
@@ -15,7 +15,7 @@ def read(filename):
15
15
 
16
16
  setup(
17
17
  name="hamsclientfork",
18
- version="0.2.17",
18
+ version="0.2.19",
19
19
  url="https://github.com/Rudd-O/hamsclientfork",
20
20
  license="MIT",
21
21
  author="websylv",
File without changes
File without changes