Skip to content

Commit

Permalink
Fix error during missing weather report
Browse files Browse the repository at this point in the history
  • Loading branch information
FL550 committed Oct 17, 2023
1 parent 8a01cc4 commit 8674b96
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 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.19",
version="2.0.20",
author="Max Fermor",
description="A simple tool to retrieve a weather forecast from DWD OpenData",
long_description=long_description,
Expand Down
5 changes: 3 additions & 2 deletions simple_dwd_weatherforecast/dwdforecast.py
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,8 @@ def parse_csv_row(self, row: dict):
else None,
WeatherDataType.VISIBILITY.value[0]: float(
row[WeatherDataType.VISIBILITY.value[1]].replace(",", ".")
) * 1e3
)
* 1e3
if row[WeatherDataType.VISIBILITY.value[1]] != self.NOT_AVAILABLE
else None,
WeatherDataType.SUN_IRRADIANCE.value[0]: float(
Expand All @@ -760,7 +761,7 @@ def parse_csv_row(self, row: dict):
}

def get_weather_report(self, shouldUpdate=False):
if shouldUpdate or self.weather_report is None:
if (shouldUpdate or self.weather_report is None) and self.region is not None:
self.update(with_report=True)
return self.weather_report

Expand Down

0 comments on commit 8674b96

Please sign in to comment.