here_location_services.platform.credentials module
This module defines classes to manage Platform credentials.
- class here_location_services.platform.credentials.PlatformCredentials(cred_properties)[source]
Bases:
object
Credentials 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
- Parameters
cred_properties (pyhocon.config_tree.ConfigTree) –
- __init__(cred_properties)[source]
Instantiate the credentials object.
- Parameters
cred_properties (pyhocon.config_tree.ConfigTree) – the properties of Credentials.
- classmethod from_default()[source]
Return the credentials object from the default 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
- Return type
here_location_services.platform.credentials.PlatformCredentials
- classmethod from_credentials_file(path)[source]
Return the credentials object from a specified credentials path.
- Parameters
path (Union[str, pathlib.Path]) – path to a HERE platform credentials.properties file.
- Returns
credentials
- Raises
ConfigException – Erroneous credentials.properties file in path
- Return type
here_location_services.platform.credentials.PlatformCredentials
- classmethod from_env()[source]
Return the credentials object from the following environment variables:
HERE_USER_ID
HERE_CLIENT_ID
HERE_ACCESS_KEY_ID
HERE_ACCESS_KEY_SECRET
HERE_TOKEN_ENDPOINT_URL
(optional)
- Returns
credentials parsed from the environment variables
- Raises
ConfigException – missing environmental variables that are mandatory
- Return type
here_location_services.platform.credentials.PlatformCredentials
- patch_using_env()[source]
Patch the credentials by reading the following environment variables and applying them accordingly.
HERE_USER_ID
HERE_CLIENT_ID
HERE_ACCESS_KEY_ID
HERE_ACCESS_KEY_SECRET
HERE_TOKEN_ENDPOINT_URL
Whenever such an environment variable is set, it overrides the one loaded from file.