Official Django integration for Traffic Orchestrator license validation
Project description
django-traffic-orchestrator
Official Django integration for Traffic Orchestrator.
📖 API Reference · SDK Guides · OpenAPI Spec
Install
pip install django-traffic-orchestrator
Configuration
# settings.py
INSTALLED_APPS = [
'traffic_orchestrator.django',
]
TRAFFIC_ORCHESTRATOR = {
'API_KEY': os.environ.get('TO_API_KEY'),
'TIMEOUT': 5,
'RETRIES': 3,
}
Middleware (Automatic License Checking)
# settings.py
MIDDLEWARE = [
'traffic_orchestrator.django.middleware.LicenseMiddleware',
# ...
]
Decorator
from traffic_orchestrator.django.decorators import require_license
@require_license(plan='pro')
def premium_view(request):
return JsonResponse({'access': 'granted'})
Template Tag
{% load traffic_orchestrator %}
{% if_licensed 'pro' %}
<div>Premium content</div>
{% endif_licensed %}
API Methods
| Method/Decorator | Auth | Description |
|---|---|---|
@require_license(plan) |
Yes | View decorator — restrict by plan |
{% if_licensed %} |
Yes | Template tag — conditional content |
validate_license(token, domain) |
No | Validate a license key |
verify_offline(token) |
No | Ed25519 offline verification |
list_licenses() |
Yes | List all licenses |
create_license(options) |
Yes | Create a new license |
add_domain(id, domain) |
Yes | Add domain to license |
remove_domain(id, domain) |
Yes | Remove domain from license |
get_usage() |
Yes | Get usage statistics |
health_check() |
No | Check API health |
Multi-Environment
# settings.py
TRAFFIC_ORCHESTRATOR = {
'API_KEY': os.environ.get('TO_API_KEY'),
# Staging
'API_URL': os.environ.get('TO_API_URL', 'https://api.trafficorchestrator.com/api/v1'),
}
Offline Verification (Enterprise)
Validate licenses locally without API calls using Ed25519 JWT signatures:
# settings.py
TRAFFIC_ORCHESTRATOR = {
'PUBLIC_KEY': os.environ.get('TO_PUBLIC_KEY'),
}
# views.py
from traffic_orchestrator.django import verify_offline
result = verify_offline(license_token)
if result.valid:
print(f"Plan: {result.plan_id}")
Requirements
- Python 3.8+
- Django 4.0+
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file traffic_orchestrator_django-2.0.0.tar.gz.
File metadata
- Download URL: traffic_orchestrator_django-2.0.0.tar.gz
- Upload date:
- Size: 8.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a65da7aaf52e586753621ec241756ee4bc0389fb667236890957d4e54c1c8b7f
|
|
| MD5 |
4ef89cf47f4ce87898a784c43ef81815
|
|
| BLAKE2b-256 |
ec2c3e8497e8a7c4ddec57508e9078d42288d66d024586b12d6a716bf382d2a5
|
File details
Details for the file traffic_orchestrator_django-2.0.0-py3-none-any.whl.
File metadata
- Download URL: traffic_orchestrator_django-2.0.0-py3-none-any.whl
- Upload date:
- Size: 10.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9639c6d792393647284c253aeceac40dd8a210736688ec49f877e725257f8372
|
|
| MD5 |
23e663d2c9ce14978c21397ff4df5899
|
|
| BLAKE2b-256 |
ca7bc92f13a30f2da9dacc0040fd5789d65b0dba3be47d3e8616e875e2a37ab1
|