Welcome to Google Books API Wrapper’s documentation!

google-books-api-wrapper is a python web api wrapper for the Google Books api. I developed this mostly for using the unauthenticated requests for searching books and getting their relevant details. This includes the authors, official title and subtitles, Publication date, Publisher, Genre, etc.utfu

GoogleBooksAPI Class

class google_books_api_wrapper.api.GoogleBooksAPI(hostname: str = 'www.googleapis.com/books', ver: str = 'v1', logger: Logger = None)

Wrapper around the Google Books REST API

Parameters:
  • hostname (str, optional) – api hostname, defaults to “www.googleapis.com/books”

  • ver (str, optional) – api version number, defaults to “v1”

  • logger (logging.Logger, optional) – package logger, defaults to None

get_book_by_isbn10(isbn10: str) Book

Retrieves a book by ISBN10 Identifier

Parameters:

isbn10 (int) – ISBN10 Book Identifier

Returns:

A Book object

Return type:

Book

get_book_by_isbn13(isbn13: str) Book

Retrieve a book by ISBN13 Identifier.

Parameters:

isbn13 (int) – ISBN13 Book Identiier

Returns:

A Book Object

Return type:

Book

get_book_by_title(title: str) Book

Retrieves a book based on it’s title

Parameters:

title (str) – Book title

Returns:

A Book object

Return type:

Book

get_books_by_author(author: str) BookSearchResultSet

Searches for books based on a particular author

Parameters:

author (str) – Book Author

Returns:

A BookSearchResultSet Object

Return type:

BookSearchResultSet

get_books_by_publisher(publisher: str) BookSearchResultSet

Retrieves books that match a publisher string

Parameters:

publisher (str) – book publisher

Returns:

A BookSearchResultSet Object

Return type:

BookSearchResultSet

get_books_by_subject(subject: str) BookSearchResultSet

Retrieve books that match a subject or genre

Parameters:

subject (str) – Subject or Genre of desired Books

Returns:

A result set of Book items

Return type:

BookSearchResultSet

search_book(search_term: str = '', isbn: str = None, title: str = None, author: str = None, publisher: str = None, subject: str = None) BookSearchResultSet

Search for a book with optional filters

Parameters:
  • search_term (str, optional) – General Search term relating to desired book, defaults to “”

  • isbn (int, optional) – ISBN Identifier, defaults to None

  • title (str, optional) – Book Title, defaults to None

  • author (str, optional) – Book Author(s), defaults to None

  • publisher (str, optional) – Book Publisher defaults to None

  • subject (str, optional) – Book Subject, defaults to None

Returns:

A BookSearchResultSet objects

Return type:

BookSearchResultSet

Book Class

class google_books_api_wrapper.models.Book(title: str, authors: list[str], id: str = None, subtitle: str = None, publisher: str = None, published_date: date = None, description: str = None, ISBN_13: str = None, ISBN_10: str = None, page_count: int = None, subjects: list[str] = None, small_thumbnail: str = None, large_thumbnail: str = None)

Represents a Book object, data derived from Google Books Api Response

Parameters:
  • title (str) – Main title of the book

  • authors (list[str]) – Authors/Writers of the book

  • subtitle (str, optional) – Subtitle of the book, defaults to None

  • publisher (str, optional) – Book’s official publisher, defaults to None

  • published_date (date, optional) – Official book publication date, defaults to None

  • description (str, optional) – Overall description of the book, defaults to None

  • ISBN_13 (str, optional) – Official ISBN-13 Identifier, defaults to None

  • ISBN_10 (str, optional) – Official ISBN-10 Identifier, defaults to None

  • page_count (int, optional) – Number of pages in book, defaults to None

  • categories (list[str], optional) – Book categories (e.g. horror, comedy, etc.), defaults to None

  • small_thumbnail (str, optional) – Small thumbnail img link from Google, defaults to None

  • large_thumbnail (str, optional) – Large thumbnail img link from Google, defaults to None

classmethod from_google_books_api_response_book_item(api_response_item: dict) Book

Generates a Book object from Google Books Web API response

Parameters:

api_response_item (HttpResult) – Response item from hitting the Google Books API Endpoint

Returns:

A Book Object

Return type:

Book

BookSearchResultSet Class

class google_books_api_wrapper.models.BookSearchResultSet(books: list[Book] = None)

Represents search results coming from the Google Books Web API

Parameters:

books (list[Book], optional) – A list of book objects, defaults to None

get_all_results() list[Book]

Returns a list of books returned for the search query

Returns:

A list of Book objects

Return type:

list[Book]

get_best_match() Book | None

Returns the closest match to the search query

Returns:

A Book object

Return type:

Book

property total_results: int

Total results found for search query

Returns:

Number of results found

Return type:

int

GoogleBooksSearchParams Class

class google_books_api_wrapper.models.GoogleBooksSearchParams(*, title: str = None, isbn: str = None, publisher: str = None, author: str = None, subject: str = None, search_term: str = '')
generate() str

Generates URL Query String based on item properties

Returns:

Query String

Return type:

str

Exceptions

exception google_books_api_wrapper.exceptions.GoogleBooksAPIException

Raised when there is an error establishing connection with Google API