Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Rohanrbharadwaj committed Nov 2, 2021
1 parent dc6e773 commit 5910c3a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions web_programming/search_books_by_isbn.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def get_openlibrary_data(olid: str = "isbn/0140328726") -> dict:
return requests.get(f"https://openlibrary.org/{new_olid}.json").json()


def summerize_book(ol_book_data: dict) -> dict:
def summarize_book(ol_book_data: dict) -> dict:
"""
Given Open Library book data, return a summary as a Python dict.
Expand Down Expand Up @@ -70,7 +70,7 @@ def summerize_book(ol_book_data: dict) -> dict:
print(f"\nSearching Open Library for ISBN: {isbn}...\n")

try:
book_summary = summerize_book(get_openlibrary_data(f"isbn/{isbn}"))
book_summary = summarize_book(get_openlibrary_data(f"isbn/{isbn}"))
print("\n".join(f"{key}: {value}" for key, value in book_summary.items()))
except JSONDecodeError: # Workaround for requests.exceptions.RequestException:
print(f"Sorry, there are no results for ISBN: {isbn}.")

0 comments on commit 5910c3a

Please sign in to comment.