mirror of
https://github.com/powerline/powerline.git
synced 2025-07-23 22:05:43 +02:00
Catch more errors in weather segment
This commit is contained in:
parent
9a95d738d5
commit
4fa17f6ff5
@ -144,7 +144,7 @@ def weather(unit='c', location_query=None):
|
|||||||
response = json.loads(_urllib_read(url))
|
response = json.loads(_urllib_read(url))
|
||||||
condition = response['query']['results']['weather']['rss']['channel']['item']['condition']
|
condition = response['query']['results']['weather']['rss']['channel']['item']['condition']
|
||||||
condition_code = int(condition['code'])
|
condition_code = int(condition['code'])
|
||||||
except (KeyError, ValueError):
|
except (KeyError, TypeError, ValueError):
|
||||||
return None
|
return None
|
||||||
icon = u'〇'
|
icon = u'〇'
|
||||||
for icon, codes in weather_conditions_codes.items():
|
for icon, codes in weather_conditions_codes.items():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user