# HG changeset patch # User Dirk Olmes # Date 1433809140 -7200 # Node ID b46d7fe6390b2c6ef082b25a41f680f4dfb45df0 # Parent 51d2c3d55f4b99922b982e66362255c71e6fe3fe re-activate the use of proxy diff -r 51d2c3d55f4b -r b46d7fe6390b backend/AbstractFeedUpdater.py --- a/backend/AbstractFeedUpdater.py Mon Jun 08 19:27:35 2015 +0200 +++ b/backend/AbstractFeedUpdater.py Tue Jun 09 02:19:00 2015 +0200 @@ -25,18 +25,21 @@ self._processEntries(result) def _retrieveFeed(self): - # Retrieving https connections over a proxy does not seem to work currently - #if self.preferences.isProxyConfigured(): - # proxyUrl = '{0}:{1}'.format(self.preferences.proxyHost(), self.preferences.proxyPort()) - # proxyHandler = ProxyHandler({'http': proxyUrl, 'https': proxyUrl}) - # result = feedparser.parse(self.feed.rss_url, handlers=[proxyHandler]) - #else: - # # when updating to python3 see http://code.google.com/p/feedparser/issues/detail?id=260 - result = feedparser.parse(self.feed.rss_url) + # when updating to python3 see http://code.google.com/p/feedparser/issues/detail?id=260 + handlers = None + if self.preferences.isProxyConfigured() and self.preferences.useProxy(): + proxyUrl = '{0}:{1}'.format(self.preferences.proxyHost(), self.preferences.proxyPort()) + proxyHandler = ProxyHandler({'http': proxyUrl, 'https': proxyUrl}) + handlers = [proxyHandler] + + result = feedparser.parse(self.feed.rss_url, handlers) + if result.bozo > 0: + log.warn('result contains bozo') + log.warn(result) # bozo flags if a feed is well-formed. # if result["bozo"] > 0: # raise FeedUpdateException() - status = result["status"] + status = result.status if status >= STATUS_ERROR: raise FeedUpdateException("HTTP status " + str(status)) return result