Switch to using arandom user agent for amazon metadata downloads

Amazon seems to have started requiring captcha instantly for the IE 11
user agent
This commit is contained in:
Kovid Goyal 2017-02-12 07:05:20 +05:30
parent 5d35c23c5e
commit 232053571e

View File

@ -12,7 +12,7 @@ from threading import Thread
from Queue import Queue, Empty from Queue import Queue, Empty
from calibre import as_unicode from calibre import as_unicode, random_user_agent
from calibre.ebooks.metadata import check_isbn from calibre.ebooks.metadata import check_isbn
from calibre.ebooks.metadata.sources.base import (Source, Option, fixcase, from calibre.ebooks.metadata.sources.base import (Source, Option, fixcase,
fixauthors) fixauthors)
@ -831,8 +831,7 @@ class Amazon(Source):
@property @property
def user_agent(self): def user_agent(self):
# IE 11 - windows 7 return random_user_agent(allow_ie=False)
return 'Mozilla/5.0 (Windows NT 6.1; Trident/7.0; rv:11.0) like Gecko'
def save_settings(self, *args, **kwargs): def save_settings(self, *args, **kwargs):
Source.save_settings(self, *args, **kwargs) Source.save_settings(self, *args, **kwargs)