Exemple #1
0
def get_book_title(isbn):
    if not amazon.is_valid_isbn(some_isbn):
        return some_isbn + " is not a valid ISBN"

    isbn10, isbn13 = isbn.fix_isbn(some_isbn)

    book_info = get_book_info(isbn10)
    return book_info['title']
Exemple #2
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 = isbn.fix_isbn(some_isbn)

    url = 'https://openlibrary.org/api/books?jscmd=data&bibkeys=ISBN:' + isbn10
    response = urllib2.urlopen(url)
    json_object = json.loads(response.read())
    return json_object
Exemple #3
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
Exemple #4
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"]