xyzspaces.iml.credentials module

This module provides a Credentials 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.

class xyzspaces.iml.credentials.Credentials(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

xyzspaces.iml.credentials.Credentials

classmethod from_credentials_file(path)[source]

Return the credentials object from a specified credentials path.

Parameters

path (str) – path to a HERE platform credentials.properties file.

Returns

credentials

Raises

ConfigException – Erroneous credentials.properties file in path

Return type

xyzspaces.iml.credentials.Credentials

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

xyzspaces.iml.credentials.Credentials

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.