Apirelio Django SDK
Native Django middleware for privacy-safe, customer-aware API analytics. The same package supports regular Django views and Django REST Framework endpoints.
pip install apirelio-django
Add the middleware after Django's authentication middleware so identity resolvers can use
request.user:
# settings.py
import os
MIDDLEWARE = [
# ...
"django.contrib.auth.middleware.AuthenticationMiddleware",
"apirelio_django.ApirelioMiddleware",
]
APIRELIO = {
"API_KEY": os.environ.get("APIRELIO_API_KEY", ""),
"ENDPOINT": os.environ.get("APIRELIO_ENDPOINT", "https://apirelio.com"),
"SERVICE": "billing-api",
"ENVIRONMENT": "production",
"INCLUDE_ROUTES": ("/api/**",),
"EXCLUDE_ROUTES": ("/api/health/", "/api/internal/**"),
"RESOLVE_CUSTOMER": "billing.apirelio.resolve_customer",
}
Resolvers receive the completed HttpRequest and may return an Apirelio customer, application or
metadata dictionary:
def resolve_customer(request):
account = getattr(request.user, "account", None)
if account is None:
return None
return {"id": str(account.id), "name": account.name, "plan": account.plan}
The middleware records the final status, duration, resolved URL pattern and DRF error code. Both synchronous and asynchronous Django handlers are supported. Events enter the bounded Python Core background queue and are flushed when the process exits. Bodies, query strings, cookies, authorization values, email addresses and client IP addresses are never captured.
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 apirelio_django-0.2.0.tar.gz.
File metadata
- Download URL: apirelio_django-0.2.0.tar.gz
- Upload date:
- Size: 8.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bd0c41d22fd9ea14ee057d4a2c75d36820df67ec45eff3797d5a79352bf9ec68
|
|
| MD5 |
f8bdfc6dabe08fe843a6e69bd47a39e4
|
|
| BLAKE2b-256 |
04df4411ff83220a88712bb8d63bd1f6d12dbf0530cc1be8b747b978ef0132cd
|
Provenance
The following attestation bundles were made for apirelio_django-0.2.0.tar.gz:
Publisher:
publish.yml on pryznar/apirelio-django
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
apirelio_django-0.2.0.tar.gz -
Subject digest:
bd0c41d22fd9ea14ee057d4a2c75d36820df67ec45eff3797d5a79352bf9ec68 - Sigstore transparency entry: 2369363286
- Sigstore integration time:
-
Permalink:
pryznar/apirelio-django@82eb6c7776e5f3e113f6bea7442f94d2c5823b25 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/pryznar
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@82eb6c7776e5f3e113f6bea7442f94d2c5823b25 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file apirelio_django-0.2.0-py3-none-any.whl.
File metadata
- Download URL: apirelio_django-0.2.0-py3-none-any.whl
- Upload date:
- Size: 6.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
75b298064c54650e46de424db5b973a9ed91580f3cf69eef36193ec8c660dc9a
|
|
| MD5 |
bec91b5b35272e7729cb55a913836e90
|
|
| BLAKE2b-256 |
9960e88b30342f232371b4323f9c1fe6738cfd3b6d21f0b8c3d91f716dd608d4
|
Provenance
The following attestation bundles were made for apirelio_django-0.2.0-py3-none-any.whl:
Publisher:
publish.yml on pryznar/apirelio-django
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
apirelio_django-0.2.0-py3-none-any.whl -
Subject digest:
75b298064c54650e46de424db5b973a9ed91580f3cf69eef36193ec8c660dc9a - Sigstore transparency entry: 2369363308
- Sigstore integration time:
-
Permalink:
pryznar/apirelio-django@82eb6c7776e5f3e113f6bea7442f94d2c5823b25 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/pryznar
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@82eb6c7776e5f3e113f6bea7442f94d2c5823b25 -
Trigger Event:
workflow_dispatch
-
Statement type: