Django v2.0.0

Django Package SDK

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

pip install django-traffic-orchestrator

Quick Start

Initialize the client and start validating licenses.

python
# Add to INSTALLED_APPS in settings.py
INSTALLED_APPS = [
    ...
    'traffic_orchestrator',
]

# Configure in settings.py
TRAFFIC_ORCHESTRATOR = {
    'BASE_URL': 'https://api.trafficorchestrator.com/api/v1',
    'API_KEY': 'your-api-key',
}

License Validation

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

python
# Use the middleware for automatic validation
MIDDLEWARE = [
    ...
    'traffic_orchestrator.middleware.LicenseMiddleware',
]

# Or validate programmatically
from traffic_orchestrator import validate_license

result = validate_license("TO-XXXX-XXXX-XXXX", "example.com")

Offline Verification

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

python
# Offline verification
from traffic_orchestrator import verify_offline

is_valid = verify_offline(
    "TO-XXXX-XXXX-XXXX",
    signature,
    public_key
)

Management API

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

python
# Management commands
python manage.py check_license TO-XXXX-XXXX-XXXX

# Or use the template tags
{% load traffic_orchestrator %}
{% license_status "TO-XXXX-XXXX-XXXX" as status %}
{% if status.valid %}Premium content{% endif %}

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