use new google api

This commit is contained in:
j 2019-01-17 15:57:31 +05:30
parent 5ad4d1d67c
commit c3cdc4ccd9

View file

@ -123,7 +123,7 @@ def find(title=None, author=None):
isbns.add(info['isbn']) isbns.add(info['isbn'])
return results return results
def info(isbn): def info_old(isbn):
url = 'http://books.google.com/books/feeds/volumes?' + urlencode({ url = 'http://books.google.com/books/feeds/volumes?' + urlencode({
'q': 'isnb:' + isbn, 'q': 'isnb:' + isbn,
'max-results':1, 'max-results':1,
@ -139,7 +139,7 @@ def info(isbn):
return info return info
return {} return {}
def info_newapi(value): def info(value):
key = 'isbn' key = 'isbn'
url = 'https://www.googleapis.com/books/v1/volumes?q=%s:%s' % (key, value) url = 'https://www.googleapis.com/books/v1/volumes?q=%s:%s' % (key, value)
api_key = settings.server.get('google_api_key') api_key = settings.server.get('google_api_key')