You can interact with the API through HTTP requests from any language or via our official Python bindings (alpha)
Authentication
Make sure to follow the previous steps described in Authentication to obtain an API key and account ID.
Installing the SGP SDK Client
To install the ScaleGP Python client, run the following command:
pip install scale-gp-beta
Configuring the Client
The SGP client can be configured with your API key and account ID. Examples on how to use the SGP client can be found in Recipes. The simplest approach is to set environment variables:
export SGP_API_KEY="your-api-key-here"
export SGP_ACCOUNT_ID="your-account-id-here"
Then instantiate the client:
from scale_gp_beta import SGPClient
client = SGPClient()
The SDK will automatically use the SGP_API_KEY and SGP_ACCOUNT_ID environment variables. You can also pass them explicitly:
from scale_gp_beta import SGPClient
client = SGPClient(
account_id="your-account-id",
api_key="your-api-key",
)
The SGPClient constructor accepts the following parameters:
| Parameter | Description | Default |
|---|
account_id | Your SGP account ID. Found in the Accounts tab of the admin dashboard. | SGP_ACCOUNT_ID environment variable |
api_key | Your SGP API key. Found in the API Keys tab of the admin dashboard. | SGP_API_KEY environment variable |
environment | The SGP environment to connect to. Possible values: production-multitenant, staging, development, local. | production-multitenant |
base_url | Override the base URL with a custom endpoint. Takes precedence over environment. | None |
Connecting to Non-Production Environments
Use the environment parameter to connect to development or staging environments:
client = SGPClient(
account_id="your-account-id",
api_key="your-api-key",
environment="development"
)
You can also override the URL directly via the SGP_CLIENT_BASE_URL environment variable or the base_url parameter (which takes precedence over environment).
The Scale GP Python client is under active development, and many of the features in this document rely on the latest versions. To make sure you have the latest version, run pip install scale-gp-beta --upgrade.