mirror of
https://github.com/home-assistant/core.git
synced 2025-07-20 03:37:07 +00:00
Update wunderground.py
This commit is contained in:
parent
469d095827
commit
aabeda2b60
@ -114,7 +114,7 @@ class WUndergroundSensor(Entity):
|
|||||||
|
|
||||||
|
|
||||||
class WUndergroundData(object):
|
class WUndergroundData(object):
|
||||||
"""Get data from Wundeground."""
|
"""Get data from Wunderground."""
|
||||||
|
|
||||||
def __init__(self, resource, pws_id, api_key, data):
|
def __init__(self, resource, pws_id, api_key, data):
|
||||||
"""Initialize the data object."""
|
"""Initialize the data object."""
|
||||||
@ -129,8 +129,8 @@ class WUndergroundData(object):
|
|||||||
"""Get the latest data from wunderground"""
|
"""Get the latest data from wunderground"""
|
||||||
try:
|
try:
|
||||||
result = requests.get(self._resource + self._api_key +
|
result = requests.get(self._resource + self._api_key +
|
||||||
'/conditions/q/pws:' + self._pws_id + '.json',
|
'/conditions/q/pws:' + self._pws_id +
|
||||||
timeout=10)
|
'.json', timeout=10)
|
||||||
if "error" in result.json():
|
if "error" in result.json():
|
||||||
raise ValueError(result.json()["response"]["error"]
|
raise ValueError(result.json()["response"]["error"]
|
||||||
["description"])
|
["description"])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user