betty.fetch.static module

Fetch content from the internet.

class betty.fetch.static.StaticFetcher[source]

Bases: Fetcher

Return predefined (static) fetch responses.

__init__(*, fetch_map: Mapping[str, FetchResponse] | None = None, fetch_file_map: Mapping[str, Path] | None = None)[source]
async fetch(url: str) FetchResponse[source]

Fetch an HTTP resource.

Raises:

FetchError – if an error occurred while fetching the content.

async fetch_file(url: str) Path[source]

Fetch a file.

Raises:

FetchError – if an error occurred while fetching the content.

Returns:

The path to the file on disk.