optionally send api key
This commit is contained in:
parent
c03f72b47c
commit
b5be527aca
1 changed files with 4 additions and 0 deletions
|
@ -8,6 +8,7 @@ import ox.web.google
|
|||
import stdnum.isbn
|
||||
|
||||
from .utils import find_isbns, get_language, decode_html_data, to_isbn13
|
||||
import settings
|
||||
|
||||
import logging
|
||||
logger = logging.getLogger(__name__)
|
||||
|
@ -40,6 +41,9 @@ def info(key, value):
|
|||
if key not in ('isbn', 'lccn', 'oclc'):
|
||||
raise IOError('unknwon key %s' % key)
|
||||
url = 'https://www.googleapis.com/books/v1/volumes?q=%s:%s' % (key, value)
|
||||
api_key = settings.server.get('google_api_key')
|
||||
if api_key:
|
||||
url += '&key=' + api_key
|
||||
if api_limit.error:
|
||||
raise IOError(url)
|
||||
while not api_limit.consume(1):
|
||||
|
|
Loading…
Reference in a new issue