project_gutenberg.gutenberg_models

Attributes

here

Classes

GutenbergAuthor

An author record as returned by the Gutendex API.

GutenbergBook

A single book record as returned by the Gutendex API.

GutenbergSearchResponse

Paginated search response from the Gutendex API.

Module Contents

class project_gutenberg.gutenberg_models.GutenbergAuthor(/, **data: Any)

Bases: pydantic.BaseModel

An author record as returned by the Gutendex API.

name: str
birth_year: int | None = None
death_year: int | None = None
class project_gutenberg.gutenberg_models.GutenbergBook(/, **data: Any)

Bases: pydantic.BaseModel

A single book record as returned by the Gutendex API.

Endpoint: GET https://gutendex.com/books/?search=<query>

id: int
title: str
authors: list[GutenbergAuthor] = []
translators: list[GutenbergAuthor] = []
subjects: list[str] = []
bookshelves: list[str] = []
languages: list[str] = []
copyright: bool | None = None
media_type: str = ''
formats: dict[str, str]
download_count: int = 0
property source_url: str

Return the canonical Project Gutenberg URL for this book.

property author_names: list[str]

Return author names in natural order (first last).

Gutenberg stores names as “Last, First”; split on the first comma and reassemble as “First Last”.

class project_gutenberg.gutenberg_models.GutenbergSearchResponse(/, **data: Any)

Bases: pydantic.BaseModel

Paginated search response from the Gutendex API.

Endpoint: GET https://gutendex.com/books/?search=<query>&page=<n>

count: int
next: str | None = None
previous: str | None = None
results: list[GutenbergBook] = []
project_gutenberg.gutenberg_models.here