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:
|
RETURNS | DESCRIPTION |
---|---|
https_headers
|
Dictionary with header information as string key-value pairs.
TYPE:
|
StreamPipesApiKeyCredentials(username=None, api_key=None)
¶
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.
Both parameters can either be passed as arguments or remain unset. If they are not passed, they are retrieved from environment variables:
SP_USERNAME
is expected to contain the usernameSP_API_KEY
is expected to contain the API key
PARAMETER | DESCRIPTION |
---|---|
username |
The username to which the API token is granted, e.g.,
TYPE:
|
api_key |
The StreamPipes API key as it is displayed in the UI.
TYPE:
|
Examples:
from_env(username_env, api_key_env)
classmethod
¶
DEPRECATED - use the class constructor instead
Returns an api key provider parameterized via environment variables.
PARAMETER | DESCRIPTION |
---|---|
username_env |
Name of the environment variable that contains the username
TYPE:
|
api_key_env |
Name of the environment variable that contains the API key
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
StreamPipesApiKeyCredentials
|
|
RAISES | DESCRIPTION |
---|---|
KeyError
|
If one of the environment variables is not defined |