Getting Started - SDK#

Authentication#

To authenticate with the Satcat SDK, you will need to configure your credentials. First, you will need an API key. You can create and manage your API Keys in the Satcat Control Center. There are three options for connecting your API key to the SDK:

  1. Configuration File (Recommended):

    The recommended way to authenticate with the Satcat SDK is through a JSON configuration file. By default, the SDK looks for a file named config.json in your current directory. However, you can set the SATCAT_CONFIG_PATH variable in your shell environment to tell the SDK to load an explicit config file.

    Once you’ve created your JSON file, add the follow details to it:

    {
        "auth_method": "client_credentials",
        "auth_client_id": "<insert api key client id>",
        "auth_client_secret": "<insert api key secret>"
    }
    

Note: You can also use this file to specify any Satcat SDK field in settings.

  1. Environment Variables:

Authentication is also exposed through environment variables:

SATCAT_AUTH_METHOD="client_credentials"
SATCAT_AUTH_CLIENT_ID="<insert api key client id>"
SATCAT_AUTH_CLIENT_SECRET="<insert api key secret>"

Note: As with the config.json file, any Satcat SDK setting can be set through environment variables. Just prepend SATCAT_ to the capitalized setting name. For example: SATCAT_DEFAULT_TIMEOUT=12000.

  1. 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 your authentication settings, you can use:

satcat.sdk.settings.auth_client_id = "<insert api key client id>"
satcat.sdk.settings.auth_client_secret = "<insert api key secret>"

Calling the SDK#

Once you have installed the SDK into your Python environment, you can import the satcat package:

import satcat

Most of the core operations using the Satcat SDK are performed using the Client object, which is designed to be used as a context manager. Once your authentication credentials have been added, the Client will be automatically authenticated for you.

from satcat.sdk.client import Client

with Client() as client:
    screenings = client.screening.list_screenings()