Skip to main content
The Edgee Python SDK provides flexible ways to instantiate a client. All methods support automatic fallback to environment variables if configuration is not fully provided.

Overview

The Edgee class constructor accepts multiple input types:
  • None or no arguments - reads from environment variables
  • str - API key string (backward compatible)
  • EdgeeConfig - Configuration dataclass (type-safe)
  • dict - Plain dictionary (flexible)
The simplest and most secure approach is to use environment variables. The SDK automatically reads EDGEE_API_KEY (required) and optionally EDGEE_BASE_URL from your environment variables.

Method 2: String API Key (Quick Start)

For quick testing or simple scripts, pass the API key directly as a string:
Note: This method uses the default base URL (https://edgee.io). To use a custom base URL, use Method 3 or 4.

Method 3: Configuration Object (Type-Safe)

For better type safety, IDE support, and code clarity, use the EdgeeConfig dataclass:

Configuration Priority

The SDK uses the following priority order when resolving configuration:
  1. Constructor argument (if provided)
  2. Environment variable (if constructor argument is missing)
  3. Default value (for base_url only, defaults to https://edgee.io)

Complete Examples

Example 1: Production Setup

Example 2: Multi-Environment Setup

Troubleshooting

”EDGEE_API_KEY is not set” Error

Problem: The SDK can’t find your API key. Solutions:
  1. Set the environment variable:
  2. Pass it directly:
  3. Use EdgeeConfig:

Custom Base URL Not Working

Problem: Your custom base URL isn’t being used. Check:
  1. Verify the base URL in your configuration
  2. Check if environment variable EDGEE_BASE_URL is overriding it
  3. Ensure you’re using the correct configuration method