blogs

Blogs domain.

class BlogEntry[source]

Bases: AuditBase

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

created_at: Mapped[datetime.datetime]

Date/time of instance creation.

id: Mapped[UUID]

UUID Primary key column.

updated_at: Mapped[datetime.datetime]

Date/time of instance last update.

class BlogEntryController[source]

Bases: Controller

Controller for BlogEntry CRUD operations.

after_request: AfterRequestHookHandler | None

A sync or async function executed before a Request is passed to any route handler.

If this function returns a value, the request will not reach the route handler, and instead this value will be used.

after_response: AfterResponseHookHandler | None

A sync or async function called after the response has been awaited.

It receives the Request instance and should not return any values.

before_request: BeforeRequestHookHandler | None

A sync or async function called immediately before calling the route handler.

It receives the Request instance and any non-None return value is used for the response, bypassing the route handler.

cache_control: CacheControlHeader | None

A CacheControlHeader header to add to route handlers of this controller.

Can be overridden by route handlers.

dependencies: Dependencies | None

A string keyed dictionary of dependency Provider instances.

dto: type[AbstractDTO] | None | EmptyType

AbstractDTO to use for (de)serializing and validation of request data.

etag: ETag | None

An etag header of type ETag to add to route handlers of this controller.

Can be overridden by route handlers.

exception_handlers: ExceptionHandlersMap | None

A map of handler functions to status codes and/or exception types.

guards: Sequence[Guard] | None

A sequence of Guard callables.

include_in_schema: bool | EmptyType

A boolean flag dictating whether the route handler should be documented in the OpenAPI schema

middleware: Sequence[Middleware] | None

A sequence of Middleware.

opt: Mapping[str, Any] | None

A string key mapping of arbitrary values that can be accessed in Guards or wherever you have access to Request or ASGI Scope.

owner: Router

The Router or Litestar app that owns the controller.

This value is set internally by Litestar and it should not be set when subclassing the controller.

parameters: ParametersMap | None

A mapping of Parameter definitions available to all application paths.

path: str

A path fragment for the controller.

All route handlers under the controller will have the fragment appended to them. If not set it defaults to /.

request_class: type[Request] | None

A custom subclass of Request to be used as the default request for all route handlers under the controller.

request_max_body_size: int | None | EmptyType

Maximum allowed size of the request body in bytes. If this size is exceeded, a ‘413 - Request Entity Too Large’ error response is returned.

response_class: type[Response] | None

A custom subclass of Response to be used as the default response for all route handlers under the controller.

response_cookies: ResponseCookies | None

A list of Cookie instances.

response_headers: ResponseHeaders | None

A string keyed dictionary mapping ResponseHeader instances.

return_dto: type[AbstractDTO] | None | EmptyType

AbstractDTO to use for serializing outbound response data.

security: Sequence[SecurityRequirement] | None

A sequence of dictionaries that to the schema of all route handlers under the controller.

signature_namespace: dict[str, Any]

A mapping of names to types for use in forward reference resolution during signature modelling.

signature_types: Sequence[Any]

A sequence of types for use in forward reference resolution during signature modelling.

These types will be added to the signature namespace using their __name__ attribute.

tags: Sequence[str] | None

A sequence of string tags that will be appended to the schema of all route handlers under the controller.

type_decoders: TypeDecodersSequence | None

A sequence of tuples, each composed of a predicate testing for type identity and a msgspec hook for deserialization.

type_encoders: TypeEncodersMap | None

A mapping of types to callables that transform them into types supported for serialization.

websocket_class: type[WebSocket] | None

A custom subclass of WebSocket to be used as the default websocket for all route handlers under the controller.

class BlogEntryCreate[source]

Bases: BlogEntryBase

Schema for creating a new BlogEntry.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class BlogEntryList[source]

Bases: BaseModel

Schema for BlogEntry list items.

model_config: ClassVar[ConfigDict] = {'from_attributes': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class BlogEntryRead[source]

Bases: BlogEntryBase

Schema for reading BlogEntry data.

model_config: ClassVar[ConfigDict] = {'from_attributes': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class BlogEntryRepository[source]

Bases: SQLAlchemyAsyncRepository[BlogEntry]

Repository for BlogEntry database operations.

async get_by_feed_id(feed_id, limit=100, offset=0)[source]

Get all entries for a specific feed.

Parameters:
  • feed_id (UUID) – The feed ID to search for.

  • limit (int) – Maximum number of entries to return.

  • offset (int) – Number of entries to skip.

Return type:

list[BlogEntry]

Returns:

List of blog entries ordered by pub_date descending.

async get_by_guid(guid)[source]

Get a blog entry by GUID.

Parameters:

guid (str) – The GUID to search for.

Return type:

BlogEntry | None

Returns:

The blog entry if found, None otherwise.

async get_entries_by_feed_ids(feed_ids, limit=100)[source]

Get entries from multiple feeds.

Parameters:
  • feed_ids (list[UUID]) – List of feed IDs to get entries from.

  • limit (int) – Maximum number of entries to return.

Return type:

list[BlogEntry]

Returns:

List of blog entries ordered by pub_date descending.

Get featured blog entries from active feeds.

Parameters:

limit (int) – Maximum number of featured entries to return.

Return type:

list[BlogEntry]

Returns:

List of featured blog entries ordered by pub_date descending.

async get_recent_entries(limit=20, offset=0)[source]

Get recent blog entries across all feeds.

Entries are ordered by publication date, with entries from higher-priority feeds (e.g., official Python blogs) appearing first when dates are similar.

Parameters:
  • limit (int) – Maximum number of entries to return.

  • offset (int) – Number of entries to skip.

Return type:

list[BlogEntry]

Returns:

List of recent blog entries ordered by pub_date descending, then feed priority.

model_type

alias of BlogEntry

class BlogEntryService[source]

Bases: SQLAlchemyAsyncRepositoryService[BlogEntry, Any]

Service for BlogEntry business logic.

async get_by_feed_id(feed_id, limit=100, offset=0)[source]

Get all entries for a specific feed.

Parameters:
  • feed_id (UUID) – The feed ID to search for.

  • limit (int) – Maximum number of entries to return.

  • offset (int) – Number of entries to skip.

Return type:

list[BlogEntry]

Returns:

List of blog entries.

async get_by_guid(guid)[source]

Get a blog entry by GUID.

Parameters:

guid (str) – The GUID to search for.

Return type:

BlogEntry | None

Returns:

The blog entry if found, None otherwise.

async get_entries_by_feed_ids(feed_ids, limit=100)[source]

Get entries from multiple feeds.

Parameters:
  • feed_ids (list[UUID]) – List of feed IDs to get entries from.

  • limit (int) – Maximum number of entries to return.

Return type:

list[BlogEntry]

Returns:

List of blog entries.

Get featured blog entries.

Parameters:

limit (int) – Maximum number of featured entries to return.

Return type:

list[BlogEntry]

Returns:

List of featured blog entries.

async get_recent_entries(limit=20, offset=0)[source]

Get recent blog entries across all feeds.

Parameters:
  • limit (int) – Maximum number of entries to return.

  • offset (int) – Number of entries to skip.

Return type:

list[BlogEntry]

Returns:

List of recent blog entries.

repository_type

alias of BlogEntryRepository

class BlogEntryUpdate[source]

Bases: BaseModel

Schema for updating a BlogEntry.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class BlogEntryWithFeed[source]

Bases: BlogEntryRead

Schema for BlogEntry with Feed information.

model_config: ClassVar[ConfigDict] = {'from_attributes': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class BlogsPageController[source]

Bases: Controller

Controller for blogs HTML pages.

after_request: AfterRequestHookHandler | None

A sync or async function executed before a Request is passed to any route handler.

If this function returns a value, the request will not reach the route handler, and instead this value will be used.

after_response: AfterResponseHookHandler | None

A sync or async function called after the response has been awaited.

It receives the Request instance and should not return any values.

before_request: BeforeRequestHookHandler | None

A sync or async function called immediately before calling the route handler.

It receives the Request instance and any non-None return value is used for the response, bypassing the route handler.

cache_control: CacheControlHeader | None

A CacheControlHeader header to add to route handlers of this controller.

Can be overridden by route handlers.

dependencies: Dependencies | None

A string keyed dictionary of dependency Provider instances.

dto: type[AbstractDTO] | None | EmptyType

AbstractDTO to use for (de)serializing and validation of request data.

etag: ETag | None

An etag header of type ETag to add to route handlers of this controller.

Can be overridden by route handlers.

exception_handlers: ExceptionHandlersMap | None

A map of handler functions to status codes and/or exception types.

guards: Sequence[Guard] | None

A sequence of Guard callables.

include_in_schema: bool | EmptyType

A boolean flag dictating whether the route handler should be documented in the OpenAPI schema

middleware: Sequence[Middleware] | None

A sequence of Middleware.

opt: Mapping[str, Any] | None

A string key mapping of arbitrary values that can be accessed in Guards or wherever you have access to Request or ASGI Scope.

owner: Router

The Router or Litestar app that owns the controller.

This value is set internally by Litestar and it should not be set when subclassing the controller.

parameters: ParametersMap | None

A mapping of Parameter definitions available to all application paths.

path: str

A path fragment for the controller.

All route handlers under the controller will have the fragment appended to them. If not set it defaults to /.

request_class: type[Request] | None

A custom subclass of Request to be used as the default request for all route handlers under the controller.

request_max_body_size: int | None | EmptyType

Maximum allowed size of the request body in bytes. If this size is exceeded, a ‘413 - Request Entity Too Large’ error response is returned.

response_class: type[Response] | None

A custom subclass of Response to be used as the default response for all route handlers under the controller.

response_cookies: ResponseCookies | None

A list of Cookie instances.

response_headers: ResponseHeaders | None

A string keyed dictionary mapping ResponseHeader instances.

return_dto: type[AbstractDTO] | None | EmptyType

AbstractDTO to use for serializing outbound response data.

security: Sequence[SecurityRequirement] | None

A sequence of dictionaries that to the schema of all route handlers under the controller.

signature_namespace: dict[str, Any]

A mapping of names to types for use in forward reference resolution during signature modelling.

signature_types: Sequence[Any]

A sequence of types for use in forward reference resolution during signature modelling.

These types will be added to the signature namespace using their __name__ attribute.

tags: Sequence[str] | None

A sequence of string tags that will be appended to the schema of all route handlers under the controller.

type_decoders: TypeDecodersSequence | None

A sequence of tuples, each composed of a predicate testing for type identity and a msgspec hook for deserialization.

type_encoders: TypeEncodersMap | None

A mapping of types to callables that transform them into types supported for serialization.

websocket_class: type[WebSocket] | None

A custom subclass of WebSocket to be used as the default websocket for all route handlers under the controller.

class BlogsPageData[source]

Bases: BaseModel

Schema for blogs page template data.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class Feed[source]

Bases: AuditBase

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

created_at: Mapped[datetime.datetime]

Date/time of instance creation.

id: Mapped[UUID]

UUID Primary key column.

updated_at: Mapped[datetime.datetime]

Date/time of instance last update.

class FeedAggregate[source]

Bases: AuditBase, NameSlugMixin

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

created_at: Mapped[datetime.datetime]

Date/time of instance creation.

id: Mapped[UUID]

UUID Primary key column.

name: Mapped[str]
slug: Mapped[str]
updated_at: Mapped[datetime.datetime]

Date/time of instance last update.

class FeedAggregateController[source]

Bases: Controller

Controller for FeedAggregate CRUD operations.

after_request: AfterRequestHookHandler | None

A sync or async function executed before a Request is passed to any route handler.

If this function returns a value, the request will not reach the route handler, and instead this value will be used.

after_response: AfterResponseHookHandler | None

A sync or async function called after the response has been awaited.

It receives the Request instance and should not return any values.

before_request: BeforeRequestHookHandler | None

A sync or async function called immediately before calling the route handler.

It receives the Request instance and any non-None return value is used for the response, bypassing the route handler.

cache_control: CacheControlHeader | None

A CacheControlHeader header to add to route handlers of this controller.

Can be overridden by route handlers.

dependencies: Dependencies | None

A string keyed dictionary of dependency Provider instances.

dto: type[AbstractDTO] | None | EmptyType

AbstractDTO to use for (de)serializing and validation of request data.

etag: ETag | None

An etag header of type ETag to add to route handlers of this controller.

Can be overridden by route handlers.

exception_handlers: ExceptionHandlersMap | None

A map of handler functions to status codes and/or exception types.

guards: Sequence[Guard] | None

A sequence of Guard callables.

include_in_schema: bool | EmptyType

A boolean flag dictating whether the route handler should be documented in the OpenAPI schema

middleware: Sequence[Middleware] | None

A sequence of Middleware.

opt: Mapping[str, Any] | None

A string key mapping of arbitrary values that can be accessed in Guards or wherever you have access to Request or ASGI Scope.

owner: Router

The Router or Litestar app that owns the controller.

This value is set internally by Litestar and it should not be set when subclassing the controller.

parameters: ParametersMap | None

A mapping of Parameter definitions available to all application paths.

path: str

A path fragment for the controller.

All route handlers under the controller will have the fragment appended to them. If not set it defaults to /.

request_class: type[Request] | None

A custom subclass of Request to be used as the default request for all route handlers under the controller.

request_max_body_size: int | None | EmptyType

Maximum allowed size of the request body in bytes. If this size is exceeded, a ‘413 - Request Entity Too Large’ error response is returned.

response_class: type[Response] | None

A custom subclass of Response to be used as the default response for all route handlers under the controller.

response_cookies: ResponseCookies | None

A list of Cookie instances.

response_headers: ResponseHeaders | None

A string keyed dictionary mapping ResponseHeader instances.

return_dto: type[AbstractDTO] | None | EmptyType

AbstractDTO to use for serializing outbound response data.

security: Sequence[SecurityRequirement] | None

A sequence of dictionaries that to the schema of all route handlers under the controller.

signature_namespace: dict[str, Any]

A mapping of names to types for use in forward reference resolution during signature modelling.

signature_types: Sequence[Any]

A sequence of types for use in forward reference resolution during signature modelling.

These types will be added to the signature namespace using their __name__ attribute.

tags: Sequence[str] | None

A sequence of string tags that will be appended to the schema of all route handlers under the controller.

type_decoders: TypeDecodersSequence | None

A sequence of tuples, each composed of a predicate testing for type identity and a msgspec hook for deserialization.

type_encoders: TypeEncodersMap | None

A mapping of types to callables that transform them into types supported for serialization.

websocket_class: type[WebSocket] | None

A custom subclass of WebSocket to be used as the default websocket for all route handlers under the controller.

class FeedAggregateCreate[source]

Bases: FeedAggregateBase

Schema for creating a new FeedAggregate.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class FeedAggregateRead[source]

Bases: FeedAggregateBase

Schema for reading FeedAggregate data.

model_config: ClassVar[ConfigDict] = {'from_attributes': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class FeedAggregateRepository[source]

Bases: SQLAlchemyAsyncRepository[FeedAggregate]

Repository for FeedAggregate database operations.

async get_by_slug(slug)[source]

Get a feed aggregate by slug.

Parameters:

slug (str) – The slug to search for.

Return type:

FeedAggregate | None

Returns:

The feed aggregate if found, None otherwise.

model_type

alias of FeedAggregate

class FeedAggregateService[source]

Bases: SQLAlchemyAsyncRepositoryService[FeedAggregate, Any]

Service for FeedAggregate business logic.

async get_by_slug(slug)[source]

Get a feed aggregate by slug.

Parameters:

slug (str) – The slug to search for.

Return type:

FeedAggregate | None

Returns:

The feed aggregate if found, None otherwise.

async get_entries_for_aggregate(aggregate_id, limit=100)[source]

Get all entries for a feed aggregate.

Parameters:
  • aggregate_id (UUID) – The aggregate ID.

  • limit (int) – Maximum number of entries to return.

Return type:

tuple[FeedAggregate | None, list[BlogEntry]]

Returns:

Tuple of (aggregate, entries).

match_fields: ClassVar[Optional[Union[list[str], str]]] = ['slug']

List of dialects that prefer to use field.id = ANY(:1) instead of field.id IN (...).

repository_type

alias of FeedAggregateRepository

class FeedAggregateUpdate[source]

Bases: BaseModel

Schema for updating a FeedAggregate.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class FeedAggregateWithFeeds[source]

Bases: FeedAggregateRead

Schema for FeedAggregate with Feeds.

model_config: ClassVar[ConfigDict] = {'from_attributes': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class FeedController[source]

Bases: Controller

Controller for Feed CRUD operations.

after_request: AfterRequestHookHandler | None

A sync or async function executed before a Request is passed to any route handler.

If this function returns a value, the request will not reach the route handler, and instead this value will be used.

after_response: AfterResponseHookHandler | None

A sync or async function called after the response has been awaited.

It receives the Request instance and should not return any values.

before_request: BeforeRequestHookHandler | None

A sync or async function called immediately before calling the route handler.

It receives the Request instance and any non-None return value is used for the response, bypassing the route handler.

cache_control: CacheControlHeader | None

A CacheControlHeader header to add to route handlers of this controller.

Can be overridden by route handlers.

dependencies: Dependencies | None

A string keyed dictionary of dependency Provider instances.

dto: type[AbstractDTO] | None | EmptyType

AbstractDTO to use for (de)serializing and validation of request data.

etag: ETag | None

An etag header of type ETag to add to route handlers of this controller.

Can be overridden by route handlers.

exception_handlers: ExceptionHandlersMap | None

A map of handler functions to status codes and/or exception types.

guards: Sequence[Guard] | None

A sequence of Guard callables.

include_in_schema: bool | EmptyType

A boolean flag dictating whether the route handler should be documented in the OpenAPI schema

middleware: Sequence[Middleware] | None

A sequence of Middleware.

opt: Mapping[str, Any] | None

A string key mapping of arbitrary values that can be accessed in Guards or wherever you have access to Request or ASGI Scope.

owner: Router

The Router or Litestar app that owns the controller.

This value is set internally by Litestar and it should not be set when subclassing the controller.

parameters: ParametersMap | None

A mapping of Parameter definitions available to all application paths.

path: str

A path fragment for the controller.

All route handlers under the controller will have the fragment appended to them. If not set it defaults to /.

request_class: type[Request] | None

A custom subclass of Request to be used as the default request for all route handlers under the controller.

request_max_body_size: int | None | EmptyType

Maximum allowed size of the request body in bytes. If this size is exceeded, a ‘413 - Request Entity Too Large’ error response is returned.

response_class: type[Response] | None

A custom subclass of Response to be used as the default response for all route handlers under the controller.

response_cookies: ResponseCookies | None

A list of Cookie instances.

response_headers: ResponseHeaders | None

A string keyed dictionary mapping ResponseHeader instances.

return_dto: type[AbstractDTO] | None | EmptyType

AbstractDTO to use for serializing outbound response data.

security: Sequence[SecurityRequirement] | None

A sequence of dictionaries that to the schema of all route handlers under the controller.

signature_namespace: dict[str, Any]

A mapping of names to types for use in forward reference resolution during signature modelling.

signature_types: Sequence[Any]

A sequence of types for use in forward reference resolution during signature modelling.

These types will be added to the signature namespace using their __name__ attribute.

tags: Sequence[str] | None

A sequence of string tags that will be appended to the schema of all route handlers under the controller.

type_decoders: TypeDecodersSequence | None

A sequence of tuples, each composed of a predicate testing for type identity and a msgspec hook for deserialization.

type_encoders: TypeEncodersMap | None

A mapping of types to callables that transform them into types supported for serialization.

websocket_class: type[WebSocket] | None

A custom subclass of WebSocket to be used as the default websocket for all route handlers under the controller.

class FeedCreate[source]

Bases: FeedBase

Schema for creating a new Feed.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class FeedDetailPageData[source]

Bases: BaseModel

Schema for feed detail page template data.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class FeedList[source]

Bases: BaseModel

Schema for Feed list items.

model_config: ClassVar[ConfigDict] = {'from_attributes': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class FeedRead[source]

Bases: FeedBase

Schema for reading Feed data.

model_config: ClassVar[ConfigDict] = {'from_attributes': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class FeedRepository[source]

Bases: SQLAlchemyAsyncRepository[Feed]

Repository for Feed database operations.

async get_active_feeds(limit=100)[source]

Get all active feeds ordered by priority.

Parameters:

limit (int) – Maximum number of feeds to return.

Return type:

list[Feed]

Returns:

List of active feeds ordered by priority (highest first).

async get_by_feed_url(feed_url)[source]

Get a feed by URL.

Parameters:

feed_url (str) – The feed URL to search for.

Return type:

Feed | None

Returns:

The feed if found, None otherwise.

async get_feeds_needing_update(cutoff_time, limit=100)[source]

Get feeds that need to be updated.

Parameters:
  • cutoff_time (datetime) – Feeds not fetched since this time will be returned.

  • limit (int) – Maximum number of feeds to return.

Return type:

list[Feed]

Returns:

List of feeds needing update.

model_type

alias of Feed

class FeedService[source]

Bases: SQLAlchemyAsyncRepositoryService[Feed, Any]

Service for Feed business logic.

async fetch_feed(feed)[source]

Fetch and parse a feed, creating or updating blog entries.

Parameters:

feed (Feed) – The feed to fetch.

Return type:

list[BlogEntry]

Returns:

List of blog entries created or updated.

async get_active_feeds(limit=100)[source]

Get all active feeds.

Parameters:

limit (int) – Maximum number of feeds to return.

Return type:

list[Feed]

Returns:

List of active feeds.

async get_by_feed_url(feed_url)[source]

Get a feed by URL.

Parameters:

feed_url (str) – The feed URL to search for.

Return type:

Feed | None

Returns:

The feed if found, None otherwise.

async get_feeds_needing_update(cutoff_time, limit=100)[source]

Get feeds that need to be updated.

Parameters:
  • cutoff_time (datetime) – Feeds not fetched since this time will be returned.

  • limit (int) – Maximum number of feeds to return.

Return type:

list[Feed]

Returns:

List of feeds needing update.

async mark_feed_as_updated(feed_id)[source]

Mark a feed as updated.

Parameters:

feed_id (UUID) – The feed ID to update.

Return type:

Feed

Returns:

The updated feed.

repository_type

alias of FeedRepository

class FeedUpdate[source]

Bases: BaseModel

Schema for updating a Feed.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class RelatedBlog[source]

Bases: AuditBase

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

created_at: Mapped[datetime.datetime]

Date/time of instance creation.

id: Mapped[UUID]

UUID Primary key column.

updated_at: Mapped[datetime.datetime]

Date/time of instance last update.

class RelatedBlogController[source]

Bases: Controller

Controller for RelatedBlog CRUD operations.

after_request: AfterRequestHookHandler | None

A sync or async function executed before a Request is passed to any route handler.

If this function returns a value, the request will not reach the route handler, and instead this value will be used.

after_response: AfterResponseHookHandler | None

A sync or async function called after the response has been awaited.

It receives the Request instance and should not return any values.

before_request: BeforeRequestHookHandler | None

A sync or async function called immediately before calling the route handler.

It receives the Request instance and any non-None return value is used for the response, bypassing the route handler.

cache_control: CacheControlHeader | None

A CacheControlHeader header to add to route handlers of this controller.

Can be overridden by route handlers.

dependencies: Dependencies | None

A string keyed dictionary of dependency Provider instances.

dto: type[AbstractDTO] | None | EmptyType

AbstractDTO to use for (de)serializing and validation of request data.

etag: ETag | None

An etag header of type ETag to add to route handlers of this controller.

Can be overridden by route handlers.

exception_handlers: ExceptionHandlersMap | None

A map of handler functions to status codes and/or exception types.

guards: Sequence[Guard] | None

A sequence of Guard callables.

include_in_schema: bool | EmptyType

A boolean flag dictating whether the route handler should be documented in the OpenAPI schema

middleware: Sequence[Middleware] | None

A sequence of Middleware.

opt: Mapping[str, Any] | None

A string key mapping of arbitrary values that can be accessed in Guards or wherever you have access to Request or ASGI Scope.

owner: Router

The Router or Litestar app that owns the controller.

This value is set internally by Litestar and it should not be set when subclassing the controller.

parameters: ParametersMap | None

A mapping of Parameter definitions available to all application paths.

path: str

A path fragment for the controller.

All route handlers under the controller will have the fragment appended to them. If not set it defaults to /.

request_class: type[Request] | None

A custom subclass of Request to be used as the default request for all route handlers under the controller.

request_max_body_size: int | None | EmptyType

Maximum allowed size of the request body in bytes. If this size is exceeded, a ‘413 - Request Entity Too Large’ error response is returned.

response_class: type[Response] | None

A custom subclass of Response to be used as the default response for all route handlers under the controller.

response_cookies: ResponseCookies | None

A list of Cookie instances.

response_headers: ResponseHeaders | None

A string keyed dictionary mapping ResponseHeader instances.

return_dto: type[AbstractDTO] | None | EmptyType

AbstractDTO to use for serializing outbound response data.

security: Sequence[SecurityRequirement] | None

A sequence of dictionaries that to the schema of all route handlers under the controller.

signature_namespace: dict[str, Any]

A mapping of names to types for use in forward reference resolution during signature modelling.

signature_types: Sequence[Any]

A sequence of types for use in forward reference resolution during signature modelling.

These types will be added to the signature namespace using their __name__ attribute.

tags: Sequence[str] | None

A sequence of string tags that will be appended to the schema of all route handlers under the controller.

type_decoders: TypeDecodersSequence | None

A sequence of tuples, each composed of a predicate testing for type identity and a msgspec hook for deserialization.

type_encoders: TypeEncodersMap | None

A mapping of types to callables that transform them into types supported for serialization.

websocket_class: type[WebSocket] | None

A custom subclass of WebSocket to be used as the default websocket for all route handlers under the controller.

class RelatedBlogCreate[source]

Bases: RelatedBlogBase

Schema for creating a new RelatedBlog.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class RelatedBlogRead[source]

Bases: RelatedBlogBase

Schema for reading RelatedBlog data.

model_config: ClassVar[ConfigDict] = {'from_attributes': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class RelatedBlogRepository[source]

Bases: SQLAlchemyAsyncRepository[RelatedBlog]

Repository for RelatedBlog database operations.

async get_all_active(limit=100)[source]

Get all related blogs.

Parameters:

limit (int) – Maximum number of blogs to return.

Return type:

list[RelatedBlog]

Returns:

List of related blogs ordered by blog name.

model_type

alias of RelatedBlog

class RelatedBlogService[source]

Bases: SQLAlchemyAsyncRepositoryService[RelatedBlog, Any]

Service for RelatedBlog business logic.

async get_all_active(limit=100)[source]

Get all related blogs.

Parameters:

limit (int) – Maximum number of blogs to return.

Return type:

list[RelatedBlog]

Returns:

List of related blogs.

repository_type

alias of RelatedBlogRepository

class RelatedBlogUpdate[source]

Bases: BaseModel

Schema for updating a RelatedBlog.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

get_blogs_dependencies()[source]

Get all blogs domain dependency providers.

Return type:

dict

models

Blogs domain models.

class Feed[source]

Bases: AuditBase

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

created_at: Mapped[datetime.datetime]

Date/time of instance creation.

id: Mapped[UUID]

UUID Primary key column.

updated_at: Mapped[datetime.datetime]

Date/time of instance last update.

class BlogEntry[source]

Bases: AuditBase

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

created_at: Mapped[datetime.datetime]

Date/time of instance creation.

id: Mapped[UUID]

UUID Primary key column.

updated_at: Mapped[datetime.datetime]

Date/time of instance last update.

class FeedAggregate[source]

Bases: AuditBase, NameSlugMixin

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

created_at: Mapped[datetime.datetime]

Date/time of instance creation.

id: Mapped[UUID]

UUID Primary key column.

name: Mapped[str]
slug: Mapped[str]
updated_at: Mapped[datetime.datetime]

Date/time of instance last update.

class RelatedBlog[source]

Bases: AuditBase

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

created_at: Mapped[datetime.datetime]

Date/time of instance creation.

id: Mapped[UUID]

UUID Primary key column.

updated_at: Mapped[datetime.datetime]

Date/time of instance last update.

schemas

Blogs domain Pydantic schemas.

class FeedBase[source]

Bases: BaseModel

Base Feed schema with common fields.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class FeedCreate[source]

Bases: FeedBase

Schema for creating a new Feed.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class FeedUpdate[source]

Bases: BaseModel

Schema for updating a Feed.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class FeedRead[source]

Bases: FeedBase

Schema for reading Feed data.

model_config: ClassVar[ConfigDict] = {'from_attributes': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class FeedList[source]

Bases: BaseModel

Schema for Feed list items.

model_config: ClassVar[ConfigDict] = {'from_attributes': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class BlogEntryBase[source]

Bases: BaseModel

Base BlogEntry schema with common fields.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class BlogEntryCreate[source]

Bases: BlogEntryBase

Schema for creating a new BlogEntry.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class BlogEntryUpdate[source]

Bases: BaseModel

Schema for updating a BlogEntry.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class BlogEntryRead[source]

Bases: BlogEntryBase

Schema for reading BlogEntry data.

model_config: ClassVar[ConfigDict] = {'from_attributes': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class BlogEntryList[source]

Bases: BaseModel

Schema for BlogEntry list items.

model_config: ClassVar[ConfigDict] = {'from_attributes': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class BlogEntryWithFeed[source]

Bases: BlogEntryRead

Schema for BlogEntry with Feed information.

model_config: ClassVar[ConfigDict] = {'from_attributes': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class FeedAggregateBase[source]

Bases: BaseModel

Base FeedAggregate schema with common fields.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class FeedAggregateCreate[source]

Bases: FeedAggregateBase

Schema for creating a new FeedAggregate.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class FeedAggregateUpdate[source]

Bases: BaseModel

Schema for updating a FeedAggregate.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class FeedAggregateRead[source]

Bases: FeedAggregateBase

Schema for reading FeedAggregate data.

model_config: ClassVar[ConfigDict] = {'from_attributes': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class FeedAggregateWithFeeds[source]

Bases: FeedAggregateRead

Schema for FeedAggregate with Feeds.

model_config: ClassVar[ConfigDict] = {'from_attributes': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class RelatedBlogBase[source]

Bases: BaseModel

Base RelatedBlog schema with common fields.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class RelatedBlogCreate[source]

Bases: RelatedBlogBase

Schema for creating a new RelatedBlog.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class RelatedBlogUpdate[source]

Bases: BaseModel

Schema for updating a RelatedBlog.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class RelatedBlogRead[source]

Bases: RelatedBlogBase

Schema for reading RelatedBlog data.

model_config: ClassVar[ConfigDict] = {'from_attributes': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class BlogsPageData[source]

Bases: BaseModel

Schema for blogs page template data.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class FeedDetailPageData[source]

Bases: BaseModel

Schema for feed detail page template data.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

services

Blogs domain services for business logic.

class FeedService[source]

Bases: SQLAlchemyAsyncRepositoryService[Feed, Any]

Service for Feed business logic.

repository_type

alias of FeedRepository

async get_by_feed_url(feed_url)[source]

Get a feed by URL.

Parameters:

feed_url (str) – The feed URL to search for.

Return type:

Feed | None

Returns:

The feed if found, None otherwise.

async get_active_feeds(limit=100)[source]

Get all active feeds.

Parameters:

limit (int) – Maximum number of feeds to return.

Return type:

list[Feed]

Returns:

List of active feeds.

async get_feeds_needing_update(cutoff_time, limit=100)[source]

Get feeds that need to be updated.

Parameters:
  • cutoff_time (datetime) – Feeds not fetched since this time will be returned.

  • limit (int) – Maximum number of feeds to return.

Return type:

list[Feed]

Returns:

List of feeds needing update.

async fetch_feed(feed)[source]

Fetch and parse a feed, creating or updating blog entries.

Parameters:

feed (Feed) – The feed to fetch.

Return type:

list[BlogEntry]

Returns:

List of blog entries created or updated.

async mark_feed_as_updated(feed_id)[source]

Mark a feed as updated.

Parameters:

feed_id (UUID) – The feed ID to update.

Return type:

Feed

Returns:

The updated feed.

class BlogEntryService[source]

Bases: SQLAlchemyAsyncRepositoryService[BlogEntry, Any]

Service for BlogEntry business logic.

repository_type

alias of BlogEntryRepository

async get_by_guid(guid)[source]

Get a blog entry by GUID.

Parameters:

guid (str) – The GUID to search for.

Return type:

BlogEntry | None

Returns:

The blog entry if found, None otherwise.

async get_by_feed_id(feed_id, limit=100, offset=0)[source]

Get all entries for a specific feed.

Parameters:
  • feed_id (UUID) – The feed ID to search for.

  • limit (int) – Maximum number of entries to return.

  • offset (int) – Number of entries to skip.

Return type:

list[BlogEntry]

Returns:

List of blog entries.

async get_recent_entries(limit=20, offset=0)[source]

Get recent blog entries across all feeds.

Parameters:
  • limit (int) – Maximum number of entries to return.

  • offset (int) – Number of entries to skip.

Return type:

list[BlogEntry]

Returns:

List of recent blog entries.

async get_entries_by_feed_ids(feed_ids, limit=100)[source]

Get entries from multiple feeds.

Parameters:
  • feed_ids (list[UUID]) – List of feed IDs to get entries from.

  • limit (int) – Maximum number of entries to return.

Return type:

list[BlogEntry]

Returns:

List of blog entries.

Get featured blog entries.

Parameters:

limit (int) – Maximum number of featured entries to return.

Return type:

list[BlogEntry]

Returns:

List of featured blog entries.

class FeedAggregateService[source]

Bases: SQLAlchemyAsyncRepositoryService[FeedAggregate, Any]

Service for FeedAggregate business logic.

repository_type

alias of FeedAggregateRepository

match_fields: ClassVar[Optional[Union[list[str], str]]] = ['slug']

List of dialects that prefer to use field.id = ANY(:1) instead of field.id IN (...).

async get_by_slug(slug)[source]

Get a feed aggregate by slug.

Parameters:

slug (str) – The slug to search for.

Return type:

FeedAggregate | None

Returns:

The feed aggregate if found, None otherwise.

async get_entries_for_aggregate(aggregate_id, limit=100)[source]

Get all entries for a feed aggregate.

Parameters:
  • aggregate_id (UUID) – The aggregate ID.

  • limit (int) – Maximum number of entries to return.

Return type:

tuple[FeedAggregate | None, list[BlogEntry]]

Returns:

Tuple of (aggregate, entries).

class RelatedBlogService[source]

Bases: SQLAlchemyAsyncRepositoryService[RelatedBlog, Any]

Service for RelatedBlog business logic.

repository_type

alias of RelatedBlogRepository

async get_all_active(limit=100)[source]

Get all related blogs.

Parameters:

limit (int) – Maximum number of blogs to return.

Return type:

list[RelatedBlog]

Returns:

List of related blogs.

controllers

Blogs domain API and page controllers.

class FeedController[source]

Bases: Controller

Controller for Feed CRUD operations.

path: str

A path fragment for the controller.

All route handlers under the controller will have the fragment appended to them. If not set it defaults to /.

tags: Sequence[str] | None

A sequence of string tags that will be appended to the schema of all route handlers under the controller.

after_request: AfterRequestHookHandler | None

A sync or async function executed before a Request is passed to any route handler.

If this function returns a value, the request will not reach the route handler, and instead this value will be used.

after_response: AfterResponseHookHandler | None

A sync or async function called after the response has been awaited.

It receives the Request instance and should not return any values.

before_request: BeforeRequestHookHandler | None

A sync or async function called immediately before calling the route handler.

It receives the Request instance and any non-None return value is used for the response, bypassing the route handler.

cache_control: CacheControlHeader | None

A CacheControlHeader header to add to route handlers of this controller.

Can be overridden by route handlers.

dependencies: Dependencies | None

A string keyed dictionary of dependency Provider instances.

dto: type[AbstractDTO] | None | EmptyType

AbstractDTO to use for (de)serializing and validation of request data.

etag: ETag | None

An etag header of type ETag to add to route handlers of this controller.

Can be overridden by route handlers.

exception_handlers: ExceptionHandlersMap | None

A map of handler functions to status codes and/or exception types.

guards: Sequence[Guard] | None

A sequence of Guard callables.

include_in_schema: bool | EmptyType

A boolean flag dictating whether the route handler should be documented in the OpenAPI schema

middleware: Sequence[Middleware] | None

A sequence of Middleware.

opt: Mapping[str, Any] | None

A string key mapping of arbitrary values that can be accessed in Guards or wherever you have access to Request or ASGI Scope.

owner: Router

The Router or Litestar app that owns the controller.

This value is set internally by Litestar and it should not be set when subclassing the controller.

parameters: ParametersMap | None

A mapping of Parameter definitions available to all application paths.

request_class: type[Request] | None

A custom subclass of Request to be used as the default request for all route handlers under the controller.

request_max_body_size: int | None | EmptyType

Maximum allowed size of the request body in bytes. If this size is exceeded, a ‘413 - Request Entity Too Large’ error response is returned.

response_class: type[Response] | None

A custom subclass of Response to be used as the default response for all route handlers under the controller.

response_cookies: ResponseCookies | None

A list of Cookie instances.

response_headers: ResponseHeaders | None

A string keyed dictionary mapping ResponseHeader instances.

return_dto: type[AbstractDTO] | None | EmptyType

AbstractDTO to use for serializing outbound response data.

security: Sequence[SecurityRequirement] | None

A sequence of dictionaries that to the schema of all route handlers under the controller.

signature_namespace: dict[str, Any]

A mapping of names to types for use in forward reference resolution during signature modelling.

signature_types: Sequence[Any]

A sequence of types for use in forward reference resolution during signature modelling.

These types will be added to the signature namespace using their __name__ attribute.

type_decoders: TypeDecodersSequence | None

A sequence of tuples, each composed of a predicate testing for type identity and a msgspec hook for deserialization.

type_encoders: TypeEncodersMap | None

A mapping of types to callables that transform them into types supported for serialization.

websocket_class: type[WebSocket] | None

A custom subclass of WebSocket to be used as the default websocket for all route handlers under the controller.

class BlogEntryController[source]

Bases: Controller

Controller for BlogEntry CRUD operations.

path: str

A path fragment for the controller.

All route handlers under the controller will have the fragment appended to them. If not set it defaults to /.

tags: Sequence[str] | None

A sequence of string tags that will be appended to the schema of all route handlers under the controller.

after_request: AfterRequestHookHandler | None

A sync or async function executed before a Request is passed to any route handler.

If this function returns a value, the request will not reach the route handler, and instead this value will be used.

after_response: AfterResponseHookHandler | None

A sync or async function called after the response has been awaited.

It receives the Request instance and should not return any values.

before_request: BeforeRequestHookHandler | None

A sync or async function called immediately before calling the route handler.

It receives the Request instance and any non-None return value is used for the response, bypassing the route handler.

cache_control: CacheControlHeader | None

A CacheControlHeader header to add to route handlers of this controller.

Can be overridden by route handlers.

dependencies: Dependencies | None

A string keyed dictionary of dependency Provider instances.

dto: type[AbstractDTO] | None | EmptyType

AbstractDTO to use for (de)serializing and validation of request data.

etag: ETag | None

An etag header of type ETag to add to route handlers of this controller.

Can be overridden by route handlers.

exception_handlers: ExceptionHandlersMap | None

A map of handler functions to status codes and/or exception types.

guards: Sequence[Guard] | None

A sequence of Guard callables.

include_in_schema: bool | EmptyType

A boolean flag dictating whether the route handler should be documented in the OpenAPI schema

middleware: Sequence[Middleware] | None

A sequence of Middleware.

opt: Mapping[str, Any] | None

A string key mapping of arbitrary values that can be accessed in Guards or wherever you have access to Request or ASGI Scope.

owner: Router

The Router or Litestar app that owns the controller.

This value is set internally by Litestar and it should not be set when subclassing the controller.

parameters: ParametersMap | None

A mapping of Parameter definitions available to all application paths.

request_class: type[Request] | None

A custom subclass of Request to be used as the default request for all route handlers under the controller.

request_max_body_size: int | None | EmptyType

Maximum allowed size of the request body in bytes. If this size is exceeded, a ‘413 - Request Entity Too Large’ error response is returned.

response_class: type[Response] | None

A custom subclass of Response to be used as the default response for all route handlers under the controller.

response_cookies: ResponseCookies | None

A list of Cookie instances.

response_headers: ResponseHeaders | None

A string keyed dictionary mapping ResponseHeader instances.

return_dto: type[AbstractDTO] | None | EmptyType

AbstractDTO to use for serializing outbound response data.

security: Sequence[SecurityRequirement] | None

A sequence of dictionaries that to the schema of all route handlers under the controller.

signature_namespace: dict[str, Any]

A mapping of names to types for use in forward reference resolution during signature modelling.

signature_types: Sequence[Any]

A sequence of types for use in forward reference resolution during signature modelling.

These types will be added to the signature namespace using their __name__ attribute.

type_decoders: TypeDecodersSequence | None

A sequence of tuples, each composed of a predicate testing for type identity and a msgspec hook for deserialization.

type_encoders: TypeEncodersMap | None

A mapping of types to callables that transform them into types supported for serialization.

websocket_class: type[WebSocket] | None

A custom subclass of WebSocket to be used as the default websocket for all route handlers under the controller.

class FeedAggregateController[source]

Bases: Controller

Controller for FeedAggregate CRUD operations.

path: str

A path fragment for the controller.

All route handlers under the controller will have the fragment appended to them. If not set it defaults to /.

tags: Sequence[str] | None

A sequence of string tags that will be appended to the schema of all route handlers under the controller.

after_request: AfterRequestHookHandler | None

A sync or async function executed before a Request is passed to any route handler.

If this function returns a value, the request will not reach the route handler, and instead this value will be used.

after_response: AfterResponseHookHandler | None

A sync or async function called after the response has been awaited.

It receives the Request instance and should not return any values.

before_request: BeforeRequestHookHandler | None

A sync or async function called immediately before calling the route handler.

It receives the Request instance and any non-None return value is used for the response, bypassing the route handler.

cache_control: CacheControlHeader | None

A CacheControlHeader header to add to route handlers of this controller.

Can be overridden by route handlers.

dependencies: Dependencies | None

A string keyed dictionary of dependency Provider instances.

dto: type[AbstractDTO] | None | EmptyType

AbstractDTO to use for (de)serializing and validation of request data.

etag: ETag | None

An etag header of type ETag to add to route handlers of this controller.

Can be overridden by route handlers.

exception_handlers: ExceptionHandlersMap | None

A map of handler functions to status codes and/or exception types.

guards: Sequence[Guard] | None

A sequence of Guard callables.

include_in_schema: bool | EmptyType

A boolean flag dictating whether the route handler should be documented in the OpenAPI schema

middleware: Sequence[Middleware] | None

A sequence of Middleware.

opt: Mapping[str, Any] | None

A string key mapping of arbitrary values that can be accessed in Guards or wherever you have access to Request or ASGI Scope.

owner: Router

The Router or Litestar app that owns the controller.

This value is set internally by Litestar and it should not be set when subclassing the controller.

parameters: ParametersMap | None

A mapping of Parameter definitions available to all application paths.

request_class: type[Request] | None

A custom subclass of Request to be used as the default request for all route handlers under the controller.

request_max_body_size: int | None | EmptyType

Maximum allowed size of the request body in bytes. If this size is exceeded, a ‘413 - Request Entity Too Large’ error response is returned.

response_class: type[Response] | None

A custom subclass of Response to be used as the default response for all route handlers under the controller.

response_cookies: ResponseCookies | None

A list of Cookie instances.

response_headers: ResponseHeaders | None

A string keyed dictionary mapping ResponseHeader instances.

return_dto: type[AbstractDTO] | None | EmptyType

AbstractDTO to use for serializing outbound response data.

security: Sequence[SecurityRequirement] | None

A sequence of dictionaries that to the schema of all route handlers under the controller.

signature_namespace: dict[str, Any]

A mapping of names to types for use in forward reference resolution during signature modelling.

signature_types: Sequence[Any]

A sequence of types for use in forward reference resolution during signature modelling.

These types will be added to the signature namespace using their __name__ attribute.

type_decoders: TypeDecodersSequence | None

A sequence of tuples, each composed of a predicate testing for type identity and a msgspec hook for deserialization.

type_encoders: TypeEncodersMap | None

A mapping of types to callables that transform them into types supported for serialization.

websocket_class: type[WebSocket] | None

A custom subclass of WebSocket to be used as the default websocket for all route handlers under the controller.

class RelatedBlogController[source]

Bases: Controller

Controller for RelatedBlog CRUD operations.

path: str

A path fragment for the controller.

All route handlers under the controller will have the fragment appended to them. If not set it defaults to /.

tags: Sequence[str] | None

A sequence of string tags that will be appended to the schema of all route handlers under the controller.

after_request: AfterRequestHookHandler | None

A sync or async function executed before a Request is passed to any route handler.

If this function returns a value, the request will not reach the route handler, and instead this value will be used.

after_response: AfterResponseHookHandler | None

A sync or async function called after the response has been awaited.

It receives the Request instance and should not return any values.

before_request: BeforeRequestHookHandler | None

A sync or async function called immediately before calling the route handler.

It receives the Request instance and any non-None return value is used for the response, bypassing the route handler.

cache_control: CacheControlHeader | None

A CacheControlHeader header to add to route handlers of this controller.

Can be overridden by route handlers.

dependencies: Dependencies | None

A string keyed dictionary of dependency Provider instances.

dto: type[AbstractDTO] | None | EmptyType

AbstractDTO to use for (de)serializing and validation of request data.

etag: ETag | None

An etag header of type ETag to add to route handlers of this controller.

Can be overridden by route handlers.

exception_handlers: ExceptionHandlersMap | None

A map of handler functions to status codes and/or exception types.

guards: Sequence[Guard] | None

A sequence of Guard callables.

include_in_schema: bool | EmptyType

A boolean flag dictating whether the route handler should be documented in the OpenAPI schema

middleware: Sequence[Middleware] | None

A sequence of Middleware.

opt: Mapping[str, Any] | None

A string key mapping of arbitrary values that can be accessed in Guards or wherever you have access to Request or ASGI Scope.

owner: Router

The Router or Litestar app that owns the controller.

This value is set internally by Litestar and it should not be set when subclassing the controller.

parameters: ParametersMap | None

A mapping of Parameter definitions available to all application paths.

request_class: type[Request] | None

A custom subclass of Request to be used as the default request for all route handlers under the controller.

request_max_body_size: int | None | EmptyType

Maximum allowed size of the request body in bytes. If this size is exceeded, a ‘413 - Request Entity Too Large’ error response is returned.

response_class: type[Response] | None

A custom subclass of Response to be used as the default response for all route handlers under the controller.

response_cookies: ResponseCookies | None

A list of Cookie instances.

response_headers: ResponseHeaders | None

A string keyed dictionary mapping ResponseHeader instances.

return_dto: type[AbstractDTO] | None | EmptyType

AbstractDTO to use for serializing outbound response data.

security: Sequence[SecurityRequirement] | None

A sequence of dictionaries that to the schema of all route handlers under the controller.

signature_namespace: dict[str, Any]

A mapping of names to types for use in forward reference resolution during signature modelling.

signature_types: Sequence[Any]

A sequence of types for use in forward reference resolution during signature modelling.

These types will be added to the signature namespace using their __name__ attribute.

type_decoders: TypeDecodersSequence | None

A sequence of tuples, each composed of a predicate testing for type identity and a msgspec hook for deserialization.

type_encoders: TypeEncodersMap | None

A mapping of types to callables that transform them into types supported for serialization.

websocket_class: type[WebSocket] | None

A custom subclass of WebSocket to be used as the default websocket for all route handlers under the controller.

class BlogsPageController[source]

Bases: Controller

Controller for blogs HTML pages.

path: str

A path fragment for the controller.

All route handlers under the controller will have the fragment appended to them. If not set it defaults to /.

include_in_schema: bool | EmptyType

A boolean flag dictating whether the route handler should be documented in the OpenAPI schema

after_request: AfterRequestHookHandler | None

A sync or async function executed before a Request is passed to any route handler.

If this function returns a value, the request will not reach the route handler, and instead this value will be used.

after_response: AfterResponseHookHandler | None

A sync or async function called after the response has been awaited.

It receives the Request instance and should not return any values.

before_request: BeforeRequestHookHandler | None

A sync or async function called immediately before calling the route handler.

It receives the Request instance and any non-None return value is used for the response, bypassing the route handler.

cache_control: CacheControlHeader | None

A CacheControlHeader header to add to route handlers of this controller.

Can be overridden by route handlers.

dependencies: Dependencies | None

A string keyed dictionary of dependency Provider instances.

dto: type[AbstractDTO] | None | EmptyType

AbstractDTO to use for (de)serializing and validation of request data.

etag: ETag | None

An etag header of type ETag to add to route handlers of this controller.

Can be overridden by route handlers.

exception_handlers: ExceptionHandlersMap | None

A map of handler functions to status codes and/or exception types.

guards: Sequence[Guard] | None

A sequence of Guard callables.

middleware: Sequence[Middleware] | None

A sequence of Middleware.

opt: Mapping[str, Any] | None

A string key mapping of arbitrary values that can be accessed in Guards or wherever you have access to Request or ASGI Scope.

owner: Router

The Router or Litestar app that owns the controller.

This value is set internally by Litestar and it should not be set when subclassing the controller.

parameters: ParametersMap | None

A mapping of Parameter definitions available to all application paths.

request_class: type[Request] | None

A custom subclass of Request to be used as the default request for all route handlers under the controller.

request_max_body_size: int | None | EmptyType

Maximum allowed size of the request body in bytes. If this size is exceeded, a ‘413 - Request Entity Too Large’ error response is returned.

response_class: type[Response] | None

A custom subclass of Response to be used as the default response for all route handlers under the controller.

response_cookies: ResponseCookies | None

A list of Cookie instances.

response_headers: ResponseHeaders | None

A string keyed dictionary mapping ResponseHeader instances.

return_dto: type[AbstractDTO] | None | EmptyType

AbstractDTO to use for serializing outbound response data.

security: Sequence[SecurityRequirement] | None

A sequence of dictionaries that to the schema of all route handlers under the controller.

signature_namespace: dict[str, Any]

A mapping of names to types for use in forward reference resolution during signature modelling.

signature_types: Sequence[Any]

A sequence of types for use in forward reference resolution during signature modelling.

These types will be added to the signature namespace using their __name__ attribute.

tags: Sequence[str] | None

A sequence of string tags that will be appended to the schema of all route handlers under the controller.

type_decoders: TypeDecodersSequence | None

A sequence of tuples, each composed of a predicate testing for type identity and a msgspec hook for deserialization.

type_encoders: TypeEncodersMap | None

A mapping of types to callables that transform them into types supported for serialization.

websocket_class: type[WebSocket] | None

A custom subclass of WebSocket to be used as the default websocket for all route handlers under the controller.

repositories

Blogs domain repositories for database access.

class FeedRepository[source]

Bases: SQLAlchemyAsyncRepository[Feed]

Repository for Feed database operations.

model_type

alias of Feed

async get_by_feed_url(feed_url)[source]

Get a feed by URL.

Parameters:

feed_url (str) – The feed URL to search for.

Return type:

Feed | None

Returns:

The feed if found, None otherwise.

async get_active_feeds(limit=100)[source]

Get all active feeds ordered by priority.

Parameters:

limit (int) – Maximum number of feeds to return.

Return type:

list[Feed]

Returns:

List of active feeds ordered by priority (highest first).

async get_feeds_needing_update(cutoff_time, limit=100)[source]

Get feeds that need to be updated.

Parameters:
  • cutoff_time (datetime) – Feeds not fetched since this time will be returned.

  • limit (int) – Maximum number of feeds to return.

Return type:

list[Feed]

Returns:

List of feeds needing update.

class BlogEntryRepository[source]

Bases: SQLAlchemyAsyncRepository[BlogEntry]

Repository for BlogEntry database operations.

model_type

alias of BlogEntry

async get_by_guid(guid)[source]

Get a blog entry by GUID.

Parameters:

guid (str) – The GUID to search for.

Return type:

BlogEntry | None

Returns:

The blog entry if found, None otherwise.

async get_by_feed_id(feed_id, limit=100, offset=0)[source]

Get all entries for a specific feed.

Parameters:
  • feed_id (UUID) – The feed ID to search for.

  • limit (int) – Maximum number of entries to return.

  • offset (int) – Number of entries to skip.

Return type:

list[BlogEntry]

Returns:

List of blog entries ordered by pub_date descending.

async get_recent_entries(limit=20, offset=0)[source]

Get recent blog entries across all feeds.

Entries are ordered by publication date, with entries from higher-priority feeds (e.g., official Python blogs) appearing first when dates are similar.

Parameters:
  • limit (int) – Maximum number of entries to return.

  • offset (int) – Number of entries to skip.

Return type:

list[BlogEntry]

Returns:

List of recent blog entries ordered by pub_date descending, then feed priority.

async get_entries_by_feed_ids(feed_ids, limit=100)[source]

Get entries from multiple feeds.

Parameters:
  • feed_ids (list[UUID]) – List of feed IDs to get entries from.

  • limit (int) – Maximum number of entries to return.

Return type:

list[BlogEntry]

Returns:

List of blog entries ordered by pub_date descending.

Get featured blog entries from active feeds.

Parameters:

limit (int) – Maximum number of featured entries to return.

Return type:

list[BlogEntry]

Returns:

List of featured blog entries ordered by pub_date descending.

class FeedAggregateRepository[source]

Bases: SQLAlchemyAsyncRepository[FeedAggregate]

Repository for FeedAggregate database operations.

model_type

alias of FeedAggregate

async get_by_slug(slug)[source]

Get a feed aggregate by slug.

Parameters:

slug (str) – The slug to search for.

Return type:

FeedAggregate | None

Returns:

The feed aggregate if found, None otherwise.

class RelatedBlogRepository[source]

Bases: SQLAlchemyAsyncRepository[RelatedBlog]

Repository for RelatedBlog database operations.

model_type

alias of RelatedBlog

async get_all_active(limit=100)[source]

Get all related blogs.

Parameters:

limit (int) – Maximum number of blogs to return.

Return type:

list[RelatedBlog]

Returns:

List of related blogs ordered by blog name.