catch exception raised if url is not reachable

This commit is contained in:
thomasv 2013-01-04 11:02:39 +01:00
parent 558ba16bc2
commit f14f22636f
1 changed files with 5 additions and 2 deletions

View File

@ -28,8 +28,11 @@ class Exchanger(threading.Thread):
self.discovery()
def discovery(self):
connection = httplib.HTTPSConnection('blockchain.info')
connection.request("GET", "/ticker")
try:
connection = httplib.HTTPSConnection('blockchain.info')
connection.request("GET", "/ticker")
except:
return
response = connection.getresponse()
if response.reason == httplib.responses[httplib.NOT_FOUND]:
return