mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-08 22:53:38 +02:00
Make user agent Mozilla/5.0
This commit is contained in:
parent
8c3c93fca3
commit
5dd28389f9
1 changed files with 3 additions and 1 deletions
|
|
@ -85,7 +85,9 @@ def fetch_url(self, url):
|
|||
if delta < self.delay:
|
||||
time.sleep(delta)
|
||||
try:
|
||||
f = urllib2.urlopen(url)
|
||||
opener = urllib2.build_opener()
|
||||
opener.addheaders = [('User-agent', 'Mozilla/5.0')]
|
||||
f = opener.open(url)
|
||||
except urllib2.URLError, err:
|
||||
if hasattr(err, 'code') and responses.has_key(err.code):
|
||||
raise FetchError, responses[err.code]
|
||||
|
|
|
|||
Loading…
Reference in a new issue