HERE Data SDK for Python credentials setup
This chapter helps you to:
- Get your credentials
- Pass credentials to the HERE Data SDK for Python
Get your credentials
All users of the HERE Platform must obtain authentication and authorization credentials.
For the available authentication options, please see the Identity & Access Management Developer Guide.
Pass Credentials to the HERE Data SDK for Python
The HERE Data SDK for Python supports the following methods to provide your credentials:
- Default credentials
- Credentials file
- Environment variables
For the next sections we assume that you obtained your credentials as described above.
The HERE platform generated app credentials should look similar to the example below:
here.user.id = <example_here>
here.client.id = <example_here>
here.access.key.id = <example_here>
here.access.key.secret = <example_here>
here.token.endpoint.url = <example_here>
Default credentials
- Precondition is that you downloaded the generated
credentials.propertiesfile from the HERE Platform - Place the credentials file at:
For Linux/MacOS: $HOME/.here/credentials.properties
For Windows: %USERPROFILE%\.here\credentials.properties
Note
If you want to access catalogs or other resources with a dedicated project scope you need to add a line like this to the credentials.properties file:
here.token.scope = <project_hrn>
Credentials file
You can specify any credentials file as an alternative to the one in the default location.
An error is raised if the specified file is not present, or if the file is not formatted properly.
Code Snippet:
platform_cred = PlatformCredentials.from_credentials_file("<Path_to_file>")
platform_obj = Platform(platform_cred)
Environment variables
You can override the default credentials by assigning values to the following environment variables:
HERE_USER_ID
HERE_CLIENT_ID
HERE_ACCESS_KEY_ID
HERE_ACCESS_KEY_SECRET
HERE_TOKEN_ENDPOINT_URL
HERE_TOKEN_SCOPE
Note 1
The environment variables
HERE_TOKEN_ENDPOINT_URLandHERE_TOKEN_SCOPEare optional.
Note 2
If you want to access catalogs or other resources with a dedicated project scope you can define that scope by setting following environment variable:
HERE_TOKEN_SCOPE=
Code snippet:
platform_cred = PlatformCredentials.from_env()Updated last month