PyPI v2.1.0

Python SDK

Official Python SDK for Traffic Orchestrator. Validate licenses, manage keys, and integrate license management into your application in minutes.

pip install traffic-orchestrator

Quick Start

Initialize the client and start validating licenses.

python
from traffic_orchestrator import Client

client = Client(
    base_url="https://api.trafficorchestrator.com/api/v1"
)

License Validation

Validate a license key against a domain with a single call.

python
# Validate a license key
result = client.validate_license(
    key="TO-XXXX-XXXX-XXXX",
    domain="example.com"
)

if result["valid"]:
    print("License active!", result["features"])

Offline Verification

Verify licenses offline using Ed25519 cryptographic signatures — no network required.

python
# Verify offline with Ed25519 signature
is_valid = client.verify_offline(
    "TO-XXXX-XXXX-XXXX",
    signature,
    public_key
)

Management API

Create licenses, list existing keys, and monitor usage with authenticated API calls.

python
# Authenticated client for management
admin = Client(
    base_url="https://api.trafficorchestrator.com/api/v1",
    api_key="your-api-key"
)

licenses = admin.list_licenses()
new_license = admin.create_license(product="my-app", plan="pro")
usage = admin.get_usage()
health = admin.health_check()

Available Methods

validateLicense()
Validate a license key against a domain
verifyOffline()
Cryptographic offline verification (Ed25519)
listLicenses()
List all licenses (requires API key)
createLicense()
Create a new license key (requires API key)
getUsage()
Retrieve usage statistics (requires API key)
healthCheck()
Check API health and connectivity
gracePeriod
Cache validation results for resilience during API outages (v2.1.0+)
clearCache()
Clear cached validation results immediately