Skip to content

Credential provider

Implementation of credential providers. A credential provider supplies the specified sort of credentials in the appropriate HTTP header format. The headers are then used by the client to connect to StreamPipes.

CredentialProvider

Bases: ABC

Abstract implementation of a credential provider. Must be inherited by all credential providers.

make_headers(http_headers=None)

Creates the HTTP headers for the specific credential provider.

Concrete authentication headers must be defined in the implementation of a credential provider.

PARAMETER DESCRIPTION
http_headers

Additional HTTP headers the generated headers are extended by.

TYPE: Optional[Dict[str, str]] DEFAULT: None

RETURNS DESCRIPTION
https_headers

Dictionary with header information as string key-value pairs.
Contains all pairs given as parameter plus the header pairs for authentication determined by the credential provider.

TYPE: Dict[str, str]

StreamPipesApiKeyCredentials(username, api_key)

Bases: CredentialProvider

A credential provider that allows authentication via a StreamPipes API Token.

The required token can be generated via the StreamPipes UI (see the description on our start-page.

PARAMETER DESCRIPTION
username

The username to which the API token is granted, e.g., demo-user@streampipes.apche.org.

TYPE: str

api_key

The StreamPipes API key as it is displayed in the UI.

TYPE: str

Examples:

see StreamPipesClient

from_env(username_env, api_key_env) classmethod

Returns an api key provider parameterized via environment variables.

PARAMETER DESCRIPTION
username_env

Name of the environment variable that contains the username

TYPE: str

api_key_env

Name of the environment variable that contains the API key

TYPE: str

RETURNS DESCRIPTION
StreamPipesApiKeyCredentials
RAISES DESCRIPTION
KeyError

If one of the environment variables is not defined