From 14282c08d2323bff66e470fa9bbc9d00c1004c07 Mon Sep 17 00:00:00 2001 From: gregor herrmann Date: Sun, 30 Aug 2020 16:54:20 +0200 Subject: [PATCH] owm.py: check for w['rain']['3h'] The missing rain key was checked but sometimes we get the rain but only the 1h interval. --- owm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 -- 2.47.3