Skip to content

sok.apis.books.google_books_api

Google Books API implementation.

API Documentation: https://developers.google.com/books/docs/v1/using Note: Google Books API is free but has rate limits.

GoogleBooksApi

class GoogleBooksApi(api_key: str = '')

Bases: BaseAPI

Google Books API implementation for book search and metadata.

Provides access to millions of books with detailed information including authors, ISBNs, publishers, and descriptions.

Initialize Google Books API.

Parameters

NameTypeDefaultDescription
api_keystr''Google Books API key (optional for basic usage).
Source

supported_content_typesproperty

List[ContentType]

Return supported content types.

supported_media_typesproperty

List[MediaType]

Return supported media types.

get_detailsasync

async def get_details(
item_id: str,
content_type: ContentType,
**kwargs,
) -> Dict[str, Any]:

Get detailed book information.

Parameters

NameTypeDescription
item_idstrGoogle Books volume ID.
content_typeContentTypeContent type of the book.
**kwargsAdditional parameters.

Returns

  • Dict[str, Any]Dictionary with detailed book metadata.
Source
async def get_related_items(item_id, content_type, **kwargs):

Get related items (not supported by Google Books).

Parameters

NameTypeDescription
item_idBook identifier.
content_typeType of content.
**kwargsAdditional parameters.

Raises

  • NotImplementedErrorAlways raised as this API doesn't support related items.
Source
async def search(
query: str,
content_type: ContentType,
**kwargs,
) -> Dict[str, Any]:

Search for books on Google Books.

Parameters

NameTypeDescription
querystrSearch query (title, author, ISBN, etc.).
content_typeContentTypeContent type to search for.
**kwargsAdditional parameters (max_results, language, etc.).

Returns

  • Dict[str, Any]Dictionary with 'results' list of matching books.
Source
Built with Kiln