betty.fetch.http module - Betty documentation

Hide navigation sidebar
Hide table of contents sidebar
Skip to content
Back to top
View this page
Toggle table of contents sidebar

# betty.fetch.http module

Fetch content from the internet.

class betty.fetch.http.HttpFetcher

  Bases: `Fetcher`

  Fetch content from the internet using an HTTP client.

  __init__(http_client: ClientSession, response_cache: Cache[FetchResponse], binary_file_cache: BinaryFileCache, ttl: int = 604800)
  async fetch(url: str) → FetchResponse

    Fetch an HTTP resource.

  async fetch_file(url: str) → Path

    Fetch a file.

    Returns:

      The path to the file on disk.