Skip to content

Commit

Permalink
responding to @hornc CR, fixing return type to None
Browse files Browse the repository at this point in the history
  • Loading branch information
mekarpeles authored and root committed Aug 21, 2018
1 parent 489a609 commit 80b03cd
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
4 changes: 3 additions & 1 deletion openlibrary/core/lending.py
Expand Up @@ -94,7 +94,9 @@ def setup(config):
config_amz_api = config.get('amazon_api')

try:
amazon_api = AmazonAPI(config_amz_api.key, config_amz_api.secret, config_amz_api.id)
amazon_api = AmazonAPI(
config_amz_api.key, config_amz_api.secret,
config_amz_api.id, MaxQPS=0.9)
except AttributeError:
amazon_api = None

Expand Down
15 changes: 11 additions & 4 deletions openlibrary/plugins/openlibrary/code.py
Expand Up @@ -773,10 +773,17 @@ def GET(self):

def is_bot():
user_agent_bots = [
'ahrefsbot', 'bingbot', 'bot', 'coccocbot', 'dotbot',
'femtosearchbot', '`googlebot', 'mojeekbot', 'musobot',
'pinterestbot', 'semrushbot', 'uptimerobot', 'yandexbot',
'yandexmobilebot', 'yoozbot'
'sputnikbot', 'dotbot', 'semrushbot',
'googlebot', 'yandexbot', 'monsidobot', 'kazbtbot',
'seznambot', 'dubbotbot', '360spider', 'redditbot',
'yandexmobilebot', 'linkdexbot', 'musobot', 'mojeekbot',
'focuseekbot', 'behloolbot', 'startmebot',
'yandexaccessibilitybot', 'uptimerobot', 'femtosearchbot',
'pinterestbot', 'toutiaospider', 'yoozbot', 'parsijoobot',
'equellaurlbot', 'donkeybot', 'paperlibot', 'nsrbot',
'discordbot', 'ahrefsbot', '`googlebot', 'coccocbot',
'buzzbot', 'laserlikebot', 'baiduspider', 'bingbot',
'mj12bot', 'yoozbotadsbot'
]
user_agent = web.ctx.env['HTTP_USER_AGENT'].lower()
return any([bot in user_agent for bot in user_agent_bots])
Expand Down
2 changes: 1 addition & 1 deletion openlibrary/plugins/upstream/code.py
Expand Up @@ -96,7 +96,7 @@ def get_amazon_metadata(isbn):
if isbn:
return cached_get_amazon_metadata(isbn)
except Exception:
return {}
return None

def _get_amazon_metadata(isbn):
try:
Expand Down

0 comments on commit 80b03cd

Please sign in to comment.