nitpick.style.fetchers.http module

Base HTTP fetcher, other fetchers can inherit from this to wrap http errors.

class nitpick.style.fetchers.http.HttpFetcher(session: CachedSession | None = None, protocols: tuple[str, ...] = (<Scheme.HTTP: 'http'>, <Scheme.HTTPS: 'https'>), domains: tuple[str, ...] = ())[source]

Bases: StyleFetcher

Fetch a style from an http/https server.

domains: tuple[str, ...] = ()
fetch(url: furl) str[source]

Fetch the style from a web location.

normalize(url: furl) furl

Normalize a URL.

Produces a canonical URL, meant to be used to uniquely identify a style resource.

  • The base name has .toml appended if not already ending in that extension

  • Individual fetchers can further normalize the path and scheme.

preprocess_relative_url(url: str) str

Preprocess a relative URL.

Only called for urls that lack a scheme (at the very least), being resolved against a base URL that matches this specific fetcher.

protocols: tuple[str, ...] = (<Scheme.HTTP: 'http'>, <Scheme.HTTPS: 'https'>)
requires_connection: ClassVar[bool] = True
session: CachedSession | None = None