From f21d97d5a2f5d1bb2b3710cd1cac46baa7df319d Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Thu, 10 Sep 2015 21:20:14 +0200 Subject: [PATCH] Add timeout for requests --- homeassistant/components/sensor/arest.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/sensor/arest.py b/homeassistant/components/sensor/arest.py index 78d173ef283..cfe88e0f0d6 100644 --- a/homeassistant/components/sensor/arest.py +++ b/homeassistant/components/sensor/arest.py @@ -65,7 +65,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None): resource = config.get('resource', None) try: - response = get(resource) + response = get(resource, timeout=10) except exceptions.MissingSchema: _LOGGER.error("Missing resource or schema in configuration. " "Add http:// to your URL.") @@ -141,7 +141,7 @@ class ArestData(object): def update(self): """ Gets the latest data from aREST device. """ try: - response = get(self.resource) + response = get(self.resource, timeout=10) if 'error' in self.data: del self.data['error'] self.data = response.json()['variables']