Fixed bug in weather.py
Weather.py doesn't always receive the correct data for visibility and fails silently - this prevents that.
This commit is contained in:
parent
8c363e5f76
commit
617eb42f17
1 changed files with 7 additions and 4 deletions
|
@ -35,10 +35,13 @@ def get_weather(location):
|
||||||
data['wind']['text'] = 'N'
|
data['wind']['text'] = 'N'
|
||||||
|
|
||||||
# visibility and pressure conversions
|
# visibility and pressure conversions
|
||||||
data['atmosphere']['visibility_km'] = \
|
try:
|
||||||
int(round(float(data['atmosphere']['visibility']) * 1.609344))
|
data['atmosphere']['visibility_km'] = \
|
||||||
data['atmosphere']['visibility_km'] = \
|
int(round(float(data['atmosphere']['visibility']) * 1.609344))
|
||||||
str(round((float(data['atmosphere']['visibility']) * 33.8637526), 2))
|
data['atmosphere']['visibility_km'] = \
|
||||||
|
str(round((float(data['atmosphere']['visibility']) * 33.8637526), 2))
|
||||||
|
except:
|
||||||
|
data['atmosphere']['visibility_km'] = "ERR"
|
||||||
|
|
||||||
# textual value for air pressure
|
# textual value for air pressure
|
||||||
rising = data['atmosphere']['rising']
|
rising = data['atmosphere']['rising']
|
||||||
|
|
Reference in a new issue