speasy.core.dataprovider module

class speasy.core.dataprovider.DataProvider(provider_name: str | None = None, provider_alt_names: List[str] | None = None, inventory_disable_proxy=False, min_proxy_version=<Version('0.13.0')>)[source]

Bases: object

Base class for all data providers.

A provider declares its names as class attributes and registers itself with register_provider(), which is all Speasy needs to route requests to it.

Parameters:
provider_name: str or None

The name of the data provider. Defaults to the NAME class attribute, and must match it when both are given.

provider_alt_names: List or None

Alternative names for the data provider, also used to register the provider’s inventory as valid aliases. Defaults to the ALIASES class attribute, and must match it when both are given.

inventory_disable_proxy: bool

If True, the inventory will be fetched directly from the provider, bypassing any proxy settings.

min_proxy_version: str

Minimum required version of the proxy server to use for fetching the inventory.

ALIASES: Tuple[str, ...] = ()
NAME: str | None = None
build_inventory(root: SpeasyIndex) → SpeasyIndex[source]

Override this method to build the inventory tree from the public inventory source.

build_private_inventory(root: SpeasyIndex) → SpeasyIndex[source]

Override this method to add private inventory items that are not fetched from the public inventory source.

update_inventory()[source]
class speasy.core.dataprovider.ParameterRangeCheck[source]

Bases: object

speasy.core.dataprovider.main_provider_name(name: str) → str | None[source]
speasy.core.dataprovider.provider_names(main_name: str) → List[str][source]
speasy.core.dataprovider.register_provider(cls)[source]

Class decorator making a data provider known to Speasy under its NAME and ALIASES class attributes. Atomic: on a name clash nothing is registered.

speasy.core.dataprovider.registered_providers() → Dict[str, type][source]

Main name -> provider class, in registration order, which is also the init order.

speasy.core.dataprovider.unregistered_provider_hint(name: str) → str[source]

For the “can’t find a provider” error: names a DataProvider subclass that declares name but was never decorated with register_provider, or returns an empty string.