Check if Google Books API key is present.

This commit is contained in:
Vishnu KS
2020-11-30 00:15:17 +05:30
parent e86b26a72e
commit d898b99562

View File

@@ -42,6 +42,7 @@ def get_details(book_object):
book_object["description"] = BeautifulSoup(description).text book_object["description"] = BeautifulSoup(description).text
else: else:
book_object["description"] = "" book_object["description"] = ""
if GOOGLE_BOOK_API_KEY.strip(" "):
# Attempt to use Google Book API # Attempt to use Google Book API
url = "https://www.googleapis.com/books/v1/volumes?q={}+inauthor:{}&key={}".format( url = "https://www.googleapis.com/books/v1/volumes?q={}+inauthor:{}&key={}".format(
book_object["title"], book_object["author"], GOOGLE_BOOK_API_KEY, book_object["title"], book_object["author"], GOOGLE_BOOK_API_KEY,