Update wunderground.py

This commit is contained in:
arsaboo 2016-08-17 16:15:07 -04:00 committed by GitHub
parent 469d095827
commit aabeda2b60

View File

@ -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"])