From: gregor herrmann Date: Sun, 30 Aug 2020 14:54:20 +0000 (+0200) Subject: owm.py: check for w['rain']['3h'] X-Git-Url: https://git.toastfreeware.priv.at/chrisu/seepark.git/commitdiff_plain/14282c08d2323bff66e470fa9bbc9d00c1004c07 owm.py: check for w['rain']['3h'] The missing rain key was checked but sometimes we get the rain but only the 1h interval. --- diff --git a/owm.py b/owm.py index 74fe6c4..d97d57e 100755 --- a/owm.py +++ b/owm.py @@ -52,7 +52,7 @@ def extractweatherdata(w): data['winddegrees'] = w['wind']['deg'] if 'deg' in w['wind'] else math.nan data['winddirection'] = degToCompass(data['winddegrees']) - data['precipitation'] = w['rain']['3h'] if 'rain' in w else math.nan + data['precipitation'] = w['rain']['3h'] if 'rain' in w and w['rain'].get('3h') else math.nan data['visibility'] = w.get('visibility', math.nan) return data