windspeed=w.get('wind').get('speed'),
winddegrees=w.get('wind').get('deg'),
cloudiness=w.get('clouds').get('all'),
+ rain=w.get('rain'),
)
data['sunrise_t'] = fromtimestamp(data['sunrise'], '%H:%M:%S')
data['date'] = fromtimestamp(data['datetime'], '%Y-%m-%d')
data['time'] = fromtimestamp(data['datetime'], '%H:%M:%S')
data['winddirection'] = degToCompass(data['winddegrees'])
+ if not data['rain'] is None:
+ data['precipitation']=data['rain'].get('3h')
+ else:
+ data['precipitation']='N/A'
return data
weather['sunrise_t'] + ';' +
weather['sunset_t'] + ';' +
str(weather['temp']) + ';' +
- ';' + # precipitation missing? or only in XML: https://openweathermap.org/current ?
- str(weather['windspeed']) + 'km/h ' + weather['winddirection'] + ';' +
+ str(weather['precipitation']) + ' mm/h;' +
+ str(weather['windspeed']) + ' km/h ' + weather['winddirection'] + ';' +
weather['weather'] + ';' +
str(weather['cloudiness'])
)