changeset 88:583400dc28a0

myrss: update user-agent string to "Mozilla/5.0 Browser" after some servers complain about "Mozilla/5.0"; show exception type in top-level exception handler log message
author paulo
date Thu, 12 Jan 2017 00:59:05 -0700
parents 747073e68c42
children 18f8c214169f
files myrss/myrss_app.py
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line diff
     1.1 --- a/myrss/myrss_app.py	Sat Sep 17 00:17:32 2016 -0700
     1.2 +++ b/myrss/myrss_app.py	Thu Jan 12 00:59:05 2017 -0700
     1.3 @@ -161,7 +161,7 @@
     1.4  def _fetch_url(url):
     1.5  	try:
     1.6  		logging.info("processing %s" % url)
     1.7 -		feed = urllib2.urlopen(urllib2.Request(url, headers={"User-Agent": "Mozilla/5.0"}), timeout=URLOPEN_TIMEOUT)
     1.8 +		feed = urllib2.urlopen(urllib2.Request(url, headers={"User-Agent": "Mozilla/5.0 Browser"}), timeout=URLOPEN_TIMEOUT)
     1.9  	except urllib2.HTTPError as e:
    1.10  		logging.info("(%s) %s" % (url, e))
    1.11  		return None
    1.12 @@ -209,7 +209,7 @@
    1.13  				if feed is not None:
    1.14  					docfeed = _process_feed(feed)
    1.15  			except Exception as e:
    1.16 -				logging.info("(%s) exception: %s" % (url, e))
    1.17 +				logging.info("(%s) exception: (%s) %s" % (url, type(e), e))
    1.18  			self._output_queue.put((idx, docfeed))
    1.19  			
    1.20