here.platform.credentials module#
This module provides a PlatformCredentials class to be used for authentication.
A credentials object can be created from a credentials.properties file obtained
from the HERE platform portal or from environment variables or from a access-token
file generated in a pipeline.
- class here.platform.credentials.CredentialsType(value)[source]#
Bases:
EnumCredentialsType enum defines the different types of credentials supported. Types: Credentials, Token.
- Credentials = 1#
- Token = 2#
- class here.platform.credentials.PlatformCredentials(cred_type: CredentialsType, cred_properties: dict)[source]#
Bases:
objectPlatformCredentials provides functions for dealing with the HERE platform Credentials.
Credentials can be read from the following locations:
The default location: “~/.here/credentials.properties”
A custom path to a credentials properties file
Environment variables
- classmethod from_credentials_file(path: str) PlatformCredentials[source]#
Return the credentials object from a specified credentials path.
- Parameters:
path – path to a HERE platform credentials.properties file.
- Returns:
credentials
- Raises:
ConfigException – Erroneous credentials.properties file in path
- classmethod from_default() PlatformCredentials[source]#
Return the credentials object from the default credential path at ‘~/.here/credentials.properties’.
If environmental variables are set, these values will override the ones found in the default file.
If no default file is found, this method will try to read the credentials from the environmental variables.
- Returns:
credentials
- classmethod from_env() PlatformCredentials[source]#
Return the credentials object from the following environment variables:
HERE_USER_IDHERE_CLIENT_IDHERE_ACCESS_KEY_IDHERE_ACCESS_KEY_SECRETHERE_TOKEN_ENDPOINT_URL(optional)HERE_TOKEN_SCOPE(optional)
- Returns:
credentials parsed from the environment variables
- Raises:
ConfigException – missing environmental variables that are mandatory
- classmethod from_token_file(path: str) PlatformCredentials[source]#
Return the credentials from a specified token file path.
- Parameters:
path – path to a HERE platform token file.
- Returns:
credentials
- Raises:
ConfigException – Erroneous token file in path
- patch_using_env()[source]#
Patch the credentials by reading the following environment variables and applying them accordingly.
HERE_USER_IDHERE_CLIENT_IDHERE_ACCESS_KEY_IDHERE_ACCESS_KEY_SECRETHERE_TOKEN_ENDPOINT_URLHERE_TOKEN_SCOPE(optional)
Whenever such an environment variable is set, it overrides the one loaded from file.