From 532852a40849a2f5cedc124b76636c7b7db9328e Mon Sep 17 00:00:00 2001 From: pictuga Date: Sun, 15 Sep 2013 18:52:34 +0200 Subject: [PATCH] Use cleaner http error catch One error type was inheriting from another one --- morss.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/morss.py b/morss.py index 243e150..9e95876 100644 --- a/morss.py +++ b/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, httplib.HTTPException, socket.timeout) as error: + except (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, httplib.HTTPException): + except (urllib2.URLError, httplib.HTTPException, socket.timeout): return False rss = feeds.parse(xml)