Catch more http exceptions
Such as InvalidURL. Subclasses of httplib.HTTPExceptionmaster
parent
9252e75923
commit
43bf021f23
4
morss.py
4
morss.py
|
@ -341,7 +341,7 @@ def Fill(item, cache, feedurl='/', fast=False):
|
|||
url = item.link.encode('utf-8')
|
||||
con = urllib2.build_opener(HTMLDownloader()).open(url, timeout=TIMEOUT)
|
||||
data = con.read()
|
||||
except (urllib2.HTTPError, urllib2.URLError, socket.timeout) as error:
|
||||
except (urllib2.HTTPError, urllib2.URLError, httplib.HTTPException, socket.timeout) as error:
|
||||
log('http error')
|
||||
cache.set(item.link, 'error-http')
|
||||
return True
|
||||
|
@ -379,7 +379,7 @@ def Gather(url, cachePath, progress=False):
|
|||
cache.set(url, xml)
|
||||
cache.set('etag', con.headers.getheader('etag'))
|
||||
cache.set('lastmodified', con.headers.getheader('last-modified'))
|
||||
except (urllib2.HTTPError, urllib2.URLError):
|
||||
except (urllib2.HTTPError, urllib2.URLError, httplib.HTTPException):
|
||||
return False
|
||||
|
||||
rss = feeds.parse(xml)
|
||||
|
|
Loading…
Reference in New Issue