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
| Name | Type | Default | Description |
|---|---|---|---|
api_key | str | '' | Google Books API key (optional for basic usage). |
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
| Name | Type | Description |
|---|---|---|
item_id | str | Google Books volume ID. |
content_type | ContentType | Content type of the book. |
**kwargs | Additional parameters. |
Returns
Dict[str, Any]Dictionary with detailed book metadata.
get_related_itemsasync
async def get_related_items(item_id, content_type, **kwargs):Get related items (not supported by Google Books).
Parameters
| Name | Type | Description |
|---|---|---|
item_id | Book identifier. | |
content_type | Type of content. | |
**kwargs | Additional parameters. |
Raises
NotImplementedErrorAlways raised as this API doesn't support related items.
searchasync
async def search( query: str, content_type: ContentType, **kwargs,) -> Dict[str, Any]:Search for books on Google Books.
Parameters
| Name | Type | Description |
|---|---|---|
query | str | Search query (title, author, ISBN, etc.). |
content_type | ContentType | Content type to search for. |
**kwargs | Additional parameters (max_results, language, etc.). |
Returns
Dict[str, Any]Dictionary with 'results' list of matching books.