Mercurial > hg > index.fcgi > www > www-1
comparison myrss/myrss_app.py @ 74:d6acf8b093b7
myrss: update user-agent string to "Mozilla/5.0" to fix servers that insist on one
author | paulo |
---|---|
date | Wed, 27 Jan 2016 01:50:15 -0700 |
parents | c7bbd3805509 |
children | 51f0da3da721 |
comparison
equal
deleted
inserted
replaced
7:ba1b1cbb0de6 | 8:d6b0b739bda9 |
---|---|
157 | 157 |
158 | 158 |
159 def _fetch_url(url): | 159 def _fetch_url(url): |
160 try: | 160 try: |
161 logging.info("processing %s" % url) | 161 logging.info("processing %s" % url) |
162 feed = urllib2.urlopen(urllib2.Request(url, headers={"User-Agent": ''}), timeout=URLOPEN_TIMEOUT) | 162 feed = urllib2.urlopen(urllib2.Request(url, headers={"User-Agent": "Mozilla/5.0"}), timeout=URLOPEN_TIMEOUT) |
163 except urllib2.HTTPError as e: | 163 except urllib2.HTTPError as e: |
164 logging.info("(%s) %s" % (url, e)) | 164 logging.info("(%s) %s" % (url, e)) |
165 return None | 165 return None |
166 | 166 |
167 return feed | 167 return feed |