Skip to content

Commit

Permalink
Upgrading requests's ConnectionError to a first-class error, marking …
Browse files Browse the repository at this point in the history
…page as bad url.
  • Loading branch information
samuelclay committed Mar 3, 2012
1 parent d7574c9 commit 18fbd5e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions apps/rss_feeds/page_importer.py
Expand Up @@ -75,7 +75,8 @@ def fetch_page(self, urllib_fallback=False, requests_exception=None):
else:
self.save_no_page()
return
except (ValueError, urllib2.URLError, httplib.BadStatusLine, httplib.InvalidURL), e:
except (ValueError, urllib2.URLError, httplib.BadStatusLine, httplib.InvalidURL,
requests.exceptions.ConnectionError), e:
self.feed.save_page_history(401, "Bad URL", e)
fp = feedparser.parse(self.feed.feed_address)
feed_link = fp.feed.get('link', "")
Expand All @@ -85,7 +86,6 @@ def fetch_page(self, urllib_fallback=False, requests_exception=None):
except (httplib.IncompleteRead), e:
self.feed.save_page_history(500, "IncompleteRead", e)
except (requests.exceptions.RequestException,
requests.exceptions.ConnectionError,
LookupError,
requests.packages.urllib3.exceptions.HTTPError), e:
logging.debug(' ***> [%-30s] Page fetch failed using requests: %s' % (self.feed, e))
Expand Down

0 comments on commit 18fbd5e

Please sign in to comment.