diff --git a/netdisco/philips_hue_nupnp.py b/netdisco/philips_hue_nupnp.py index adc82e48..493bb591 100644 --- a/netdisco/philips_hue_nupnp.py +++ b/netdisco/philips_hue_nupnp.py @@ -46,7 +46,7 @@ def __init__(self): def scan(self): """Scan the network.""" try: - response = requests.get(self.PHUE_NUPNP_URL) + response = requests.get(self.PHUE_NUPNP_URL, timeout=5) response.raise_for_status() self.entries = [] bridges = response.json() @@ -63,7 +63,7 @@ def fetch_description(self, bridge): """Fetches description XML of a Philips Hue bridge.""" url = self.bridge_description_url(bridge) try: - response = requests.get(url) + response = requests.get(url, timeout=5) response.raise_for_status() return PHueBridge(response.text) except requests.exceptions.RequestException as err: diff --git a/netdisco/ssdp.py b/netdisco/ssdp.py index 8d8c1748..6b71660c 100644 --- a/netdisco/ssdp.py +++ b/netdisco/ssdp.py @@ -128,24 +128,24 @@ def description(self): if url not in UPNPEntry.DESCRIPTION_CACHE: try: - xml = requests.get(url).text + xml = requests.get(url, timeout=5).text if not xml: # Samsung Smart TV sometimes returns an empty document the # first time. Retry once. - xml = requests.get(url).text + xml = requests.get(url, timeout=5).text tree = ElementTree.fromstring(xml) UPNPEntry.DESCRIPTION_CACHE[url] = \ etree_to_dict(tree).get('root', {}) except requests.RequestException: - logging.getLogger(__name__).error( + logging.getLogger(__name__).warning( "Error fetching description at %s", url) UPNPEntry.DESCRIPTION_CACHE[url] = {} except ElementTree.ParseError: - logging.getLogger(__name__).error( + logging.getLogger(__name__).warning( "Found malformed XML at %s: %s", url, xml) UPNPEntry.DESCRIPTION_CACHE[url] = {} diff --git a/setup.py b/setup.py index 6b243f5a..59d5da84 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ from setuptools import setup, find_packages setup(name='netdisco', - version='0.9.0', + version='0.9.1', description='Discover devices on your local network', url='https://github.com/home-assistant/netdisco', author='Paulus Schoutsen',