Skip to content

Commit

Permalink
Fix report stations with 4 characters
Browse files Browse the repository at this point in the history
  • Loading branch information
FL550 committed Sep 18, 2023
1 parent 34e9a77 commit b234053
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="simple_dwd_weatherforecast",
version="2.0.11",
version="2.0.12",
author="Max Fermor",
description="A simple tool to retrieve a weather forecast from DWD OpenData",
long_description=long_description,
Expand Down
5 changes: 4 additions & 1 deletion simple_dwd_weatherforecast/dwdforecast.py
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,10 @@ def download_latest_kml(self, stationid, force_hourly=False):
self.parse_kml(kml, force_hourly)

def download_latest_report(self):
url = f"https://opendata.dwd.de/weather/weather_reports/poi/{self.station_id}-BEOB.csv"
station_id = self.station_id
if len(station_id) == 4:
station_id = station_id + '_'
url = f"https://opendata.dwd.de/weather/weather_reports/poi/{station_id}-BEOB.csv"
headers = {"If-None-Match": self.etags[url] if url in self.etags else ""}
response = requests.get(url, headers=headers)
if response.status_code == 200:
Expand Down

0 comments on commit b234053

Please sign in to comment.