Don't hang or crash in checkupdates

This commit is contained in:
Ciaran Gultnieks 2013-05-31 07:50:21 +01:00
parent 6752665db7
commit 78aa9d1874

View file

@ -173,7 +173,7 @@ def check_market(app):
headers = {'User-Agent' : 'Mozilla/5.0 (X11; Linux i686; rv:18.0) Gecko/20100101 Firefox/18.0'} headers = {'User-Agent' : 'Mozilla/5.0 (X11; Linux i686; rv:18.0) Gecko/20100101 Firefox/18.0'}
req = urllib2.Request(url, None, headers) req = urllib2.Request(url, None, headers)
try: try:
resp = urllib2.urlopen(req) resp = urllib2.urlopen(req, None, 20)
except urllib2.HTTPError, e: except urllib2.HTTPError, e:
if e.code == 404: if e.code == 404:
return (None, 'Not in market') return (None, 'Not in market')
@ -182,6 +182,8 @@ def check_market(app):
sys.exit(1) sys.exit(1)
else: else:
return (None, 'Failed with HTTP status' + str(req.getcode())) return (None, 'Failed with HTTP status' + str(req.getcode()))
except Exception, e:
return (None, 'Failed:' + str(e))
page = resp.read() page = resp.read()
version = None version = None