From 8674b96fb42fc6d07564556e0d108cc609dab52f Mon Sep 17 00:00:00 2001 From: FL550 Date: Tue, 17 Oct 2023 18:11:17 +0200 Subject: [PATCH] Fix error during missing weather report --- setup.py | 2 +- simple_dwd_weatherforecast/dwdforecast.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 402c9b9..60cf858 100644 --- a/setup.py +++ b/setup.py @@ -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, diff --git a/simple_dwd_weatherforecast/dwdforecast.py b/simple_dwd_weatherforecast/dwdforecast.py index c64c542..fce3ccb 100644 --- a/simple_dwd_weatherforecast/dwdforecast.py +++ b/simple_dwd_weatherforecast/dwdforecast.py @@ -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( @@ -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