Skip to content

Instantly share code, notes, and snippets.

@barangerbenjamin
Created April 14, 2021 09:34
Show Gist options
  • Save barangerbenjamin/374fdee99ef36a0cbd96e44a324b33b2 to your computer and use it in GitHub Desktop.
Save barangerbenjamin/374fdee99ef36a0cbd96e44a324b33b2 to your computer and use it in GitHub Desktop.
import requests
# url = 'https://api.github.com/users/ssaunier'
# response = requests.get(url).json()
# print(response['name'])
# ------------------------------------------------
def get_book_info(isbn):
url = f"https://openlibrary.org/api/books?bibkeys=ISBN:{isbn}&format=json&jscmd=data"
response = requests.get(url).json()
return response[f"ISBN:{isbn}"]['title']
print(get_book_info(9780747532699))
isbns = [9780747532699, 9780747532699, 9780747532699, 9780747532699]
for isbn in isbns:
print(get_book_info(isbn))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment