Using Google’s Book API
This will be a short article on the use of Google’s book API, to get more information about a book, in Python. This article will be a short introduction to how the API works, and the cool options you have at your disposal.
All information covered here can also be found on Google Books APIs docs (https://developers.google.com/books/docs/v1/using), but this will hopefully be more of an easier-to-read, high-level introduction.
The most basic use of the API is by getting book information from an ISBN. An ISBN is either a 10-digit (ISBN-10) or 13-digit (ISBN-13) number, which uniquely identifies a book. ISBNs for books can be found in many places. If you have a physical book, it is usually on the backside together with the barcode. If you want to find the ISBN of an online book, the easiest way is often to go to an Amazon page for that book and scroll down until you see the ISBNs, like Dune in the picture below. You can then use this ISBN in a request in Python, as you see in the code under. It should be noted that while Google’s book API contains very many books, it doesn’t always cover both ISBN-10 and ISBN-13. For example with Dune, where the API only covers ISBN-10.
#making a request to Google's book API with ISBNs
import requests
isbn10 = "0441172717"
isbn13 = "978-0441172719"
response = requests.get(f"https://www.googleapis.com/books/v1/volumes?q=isbn:{isbn10}").json()
response2 = requests.get(f"https://www.googleapis.com/books/v1/volumes?q=isbn:{isbn13}").json() #does not return information on the book