Exemplo n.º 1
0
def get_book_info(some_isbn):
    if not amazon.is_valid_isbn(some_isbn):
        return some_isbn + " is not a valid ISBN"

    isbn10, isbn13 = amazon.fix_isbn(some_isbn)

    url = "http://isbndb.com/api/v2/json/" + ISBNDB_ACCOUNT_NUMBER + "/book/" + isbn13
    response = urllib2.urlopen(url)
    book_info = json.loads(response.read())
    return book_info
Exemplo n.º 2
0
def get_book_title(some_isbn):
    if not amazon.is_valid_isbn(some_isbn):
        return some_isbn + " is not a valid ISBN"

    isbn10, isbn13 = amazon.fix_isbn(some_isbn)

    book_info = get_book_info(isbn13)

    # the following statement assumes the isbn was found.
    # we should probably test for error conditions.
    return book_info["data"][0]["title_latin"]