Configuration#
Configuration Methods#
Settings and configuration for the Satcat SDK, such as credentials and timeouts, can be configured in three different ways:
Configuration File
The recommended way for most users to configure the Satcat SDK is through a JSON configuration file. By setting values in this file, you can set any of the configurations exposed in the settings
module.
By default, the SDK looks in your current directory for a file called config.json
. However, you can set the SATCAT_CONFIG_PATH
variable in your shell environment to tell the SDK to load an explicit config file.
To use the configuration file, you can set a key in the config.json
for any of the fields available in settings
. For example, to configure the auth_client_id
variable in a config file, you can set:
{
"auth_client_id": "<insert client id>"
}
Environment variables
You can also set any field in settings
using environment variables. To set a given field, you can set an environment variable with the setting’s name in caps prefixed with the string SATCAT_
. For exmaple, to configure the auth_client_id
variable in a config file, you can set:
SATCAT_AUTH_CLIENT_ID="<insert client id>"
Python Code
You can also directly set any field in settings
at runtime in a Python script which uses the Satcat SDK. For example, to configure the auth_client_id
variable, you can use:
satcat.sdk.settings.auth_client_id = "<insert client id>"
Authentication#
Because the Satcat SDK is an API client for the Satcat API suite, use of the Satcat SDK requires authentication with the Satcat platform. You must create an API key to authenticate with the Satcat SDK. API keys can be created and managed through the Satcat Control Center.
There are three options for connecting an API key with the SDK:
Configuration File (Recommended):
{
"auth_method": "client_credentials",
"auth_client_id": "<insert api key client id>",
"auth_client_secret": "<insert api key secret>"
}
Environment Variables:
SATCAT_AUTH_METHOD="client_credentials"
SATCAT_AUTH_CLIENT_ID="<insert api key client id>"
SATCAT_AUTH_CLIENT_SECRET="<insert api key secret>"
Python Code:
satcat.sdk.settings.auth_client_id = "<insert api key client id>"
satcat.sdk.settings.auth_client_secret = "<insert api key secret>"
Note that both the SDK and CLI include auto-refreshing authentication tokens, so any long lasting job should automatically refresh the session to maintain your access.