Exercises
Work together to solve these problems:
- using isbndb.py (and API key W8NQQ89H), write a function that asks the user for a name of a book, queries isbndb.com, and prints out the top 5 results.
- write a function to read this file of book information and add the books to your library (for extra credit, also include data from isbndb.com)
- write a function that asks the user for an isbn number, queries isbndb.com, and adds the book to your library.
Examples for using isbndb.py:
import isbndb
from pprint import pprint
book_data = isbndb.by_isbn('W8NQQ89H', '9781852332709')
# book_data acts like a list of results from isbndb.com. you can
# get the first result with book_data[0]
# (there should be only 1 result for isbn queries)
pprint(book_data[0])
book_data = isbndb.by_title('W8NQQ89H', '"learning python"')
# notice the double quotes around the title.
# that lets you search for an exact match (as far as I can tell).
for book in book_data:
pprint(book)