User IOError to catch errors

Most http related exceptions inherit from that one
master
pictuga 2013-11-30 17:33:57 +01:00
parent 7156dd5522
commit 363014ee4c
1 changed files with 2 additions and 2 deletions

View File

@ -410,7 +410,7 @@ def Fill(item, cache, feedurl='/', fast=False):
url = link.encode('utf-8') url = link.encode('utf-8')
con = urllib2.build_opener(SimpleDownload(decode=True)).open(url, timeout=TIMEOUT) con = urllib2.build_opener(SimpleDownload(decode=True)).open(url, timeout=TIMEOUT)
data = con.read() data = con.read()
except (urllib2.URLError, httplib.HTTPException, socket.timeout): except (IOError, httplib.HTTPException):
log('http error') log('http error')
cache.set(link, 'error-http') cache.set(link, 'error-http')
return True return True
@ -462,7 +462,7 @@ def Gather(url, cachePath, options):
opener = SimpleDownload(cache.get(url), cache.get('etag'), cache.get('lastmodified'), decode=False) opener = SimpleDownload(cache.get(url), cache.get('etag'), cache.get('lastmodified'), decode=False)
con = urllib2.build_opener(opener).open(url, timeout=TIMEOUT) con = urllib2.build_opener(opener).open(url, timeout=TIMEOUT)
xml = con.read() xml = con.read()
except (urllib2.URLError, httplib.HTTPException, socket.timeout): except (IOError, httplib.HTTPException):
return False return False
cache.set('xml', xml) cache.set('xml', xml)