From 87f81bf3b48e7dc2a62d5819382b42618541433d Mon Sep 17 00:00:00 2001 From: "Teagan M. Glenn" Date: Wed, 17 Aug 2016 22:32:19 -0600 Subject: [PATCH] Use url builder helper --- homeassistant/components/sensor/wunderground.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/homeassistant/components/sensor/wunderground.py b/homeassistant/components/sensor/wunderground.py index 5c524c3f749..8dc3038cadb 100644 --- a/homeassistant/components/sensor/wunderground.py +++ b/homeassistant/components/sensor/wunderground.py @@ -152,11 +152,7 @@ class WUndergroundData(object): def update(self): """Get the latest data from wunderground.""" try: - result = requests.get(self._resource + self._api_key + - '/conditions/q/pws:' + self._pws_id + - '.json', timeout=10) - if "error" in result.json(): - raise ValueError(result.json()["response"]["error"] + result = requests.get(self._build_url(), timeout=10).json() ["description"]) else: self.data = result.json()["current_observation"]