Use url builder helper
parent
d2ba8ee0a7
commit
87f81bf3b4
|
@ -152,11 +152,7 @@ class WUndergroundData(object):
|
||||||
def update(self):
|
def update(self):
|
||||||
"""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._build_url(), timeout=10).json()
|
||||||
'/conditions/q/pws:' + self._pws_id +
|
|
||||||
'.json', timeout=10)
|
|
||||||
if "error" in result.json():
|
|
||||||
raise ValueError(result.json()["response"]["error"]
|
|
||||||
["description"])
|
["description"])
|
||||||
else:
|
else:
|
||||||
self.data = result.json()["current_observation"]
|
self.data = result.json()["current_observation"]
|
||||||
|
|
Loading…
Reference in New Issue