This repository was archived by the owner on Oct 1, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +7
-7
lines changed
Expand file tree Collapse file tree 3 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ def __init__(self):
4646 def scan (self ):
4747 """Scan the network."""
4848 try :
49- response = requests .get (self .PHUE_NUPNP_URL )
49+ response = requests .get (self .PHUE_NUPNP_URL , timeout = 5 )
5050 response .raise_for_status ()
5151 self .entries = []
5252 bridges = response .json ()
@@ -63,7 +63,7 @@ def fetch_description(self, bridge):
6363 """Fetches description XML of a Philips Hue bridge."""
6464 url = self .bridge_description_url (bridge )
6565 try :
66- response = requests .get (url )
66+ response = requests .get (url , timeout = 5 )
6767 response .raise_for_status ()
6868 return PHueBridge (response .text )
6969 except requests .exceptions .RequestException as err :
Original file line number Diff line number Diff line change @@ -128,24 +128,24 @@ def description(self):
128128
129129 if url not in UPNPEntry .DESCRIPTION_CACHE :
130130 try :
131- xml = requests .get (url ).text
131+ xml = requests .get (url , timeout = 5 ).text
132132 if not xml :
133133 # Samsung Smart TV sometimes returns an empty document the
134134 # first time. Retry once.
135- xml = requests .get (url ).text
135+ xml = requests .get (url , timeout = 5 ).text
136136
137137 tree = ElementTree .fromstring (xml )
138138
139139 UPNPEntry .DESCRIPTION_CACHE [url ] = \
140140 etree_to_dict (tree ).get ('root' , {})
141141 except requests .RequestException :
142- logging .getLogger (__name__ ).error (
142+ logging .getLogger (__name__ ).warning (
143143 "Error fetching description at %s" , url )
144144
145145 UPNPEntry .DESCRIPTION_CACHE [url ] = {}
146146
147147 except ElementTree .ParseError :
148- logging .getLogger (__name__ ).error (
148+ logging .getLogger (__name__ ).warning (
149149 "Found malformed XML at %s: %s" , url , xml )
150150
151151 UPNPEntry .DESCRIPTION_CACHE [url ] = {}
Original file line number Diff line number Diff line change 11from setuptools import setup , find_packages
22
33setup (name = 'netdisco' ,
4- version = '0.9.0 ' ,
4+ version = '0.9.1 ' ,
55 description = 'Discover devices on your local network' ,
66 url = 'https://github.com/home-assistant/netdisco' ,
77 author = 'Paulus Schoutsen' ,
You can’t perform that action at this time.
0 commit comments