naulon for Python
Charge AI agents to read your site from inside your Python web app. People always read free.
naulon is a middleware for Django, any WSGI app and any ASGI app. It decides who is asking from a
policy it caches in the background, so a reader never waits on the network. When an AI agent asks
for an article, it answers 402 Payment Required with a price the gate builds, and serves the
article once the agent pays in USDC. The money goes from the agent straight to your wallet: nothing
in this package can hold or move it.
No runtime dependencies. Python 3.10 or newer.
Install
pip install naulon
Web Bot Auth signature checks (agents that sign their requests) need one extra:
pip install 'naulon[botauth]'
Django
Add the middleware after WhiteNoiseMiddleware (or near the top if you have none):
MIDDLEWARE = [
# ...
"naulon.adapters.django.NaulonMiddleware",
]
NAULON = {
# Which responses are articles. Called only for agents, after your view ran.
"TOLLABLE": "myapp.naulon_hooks.tollable",
}
def tollable(request, response):
return getattr(request, "naulon_post", None) is not None and response.status_code == 200
Then point it at a gate:
NAULON_GATE=https://gate.your-site.com
NAULON_KEY=<your enforce key>
WSGI and ASGI
from naulon.adapters.wsgi import NaulonWSGI
app = NaulonWSGI(app)
from naulon.adapters.asgi import NaulonASGI
app = NaulonASGI(app)
Settings
| Variable | Default | |
|---|---|---|
NAULON_GATE |
unset | The gate's URL. Unset, the middleware does nothing |
NAULON_KEY |
unset | The enforce key the gate gave you |
NAULON_ENABLED |
1 |
0 turns the middleware into a no-op |
NAULON_TIMEOUT |
2.0 |
Seconds to wait for the gate on an agent request |
Django may set the same keys in settings.NAULON (GATE, KEY, ENABLED, TIMEOUT); the
environment wins. The middleware prices the URL Django sees, so behind a proxy that terminates TLS set
USE_X_FORWARDED_HOST = True and SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https"),
and only when the proxy overwrites both headers on every request. Behind a proxy that writes the caller's address into a single-value header, name
it in NAULON["TRUST_PROXY_HEADERS"] (for example "X-Real-IP"). X-Forwarded-For is refused:
the caller writes its first entry.
Hosted or self-hosted
The gate is open source. Run it yourself with NAULON_ENFORCE_KEY set, or use the hosted one at
https://gate.naulon.app with the key from your dashboard. The middleware is the same either way.
What it promises your site
- Your page always wins. Any error, timeout or bad answer inside naulon serves the request untouched.
- People never wait on the network. The policy refreshes in a background thread.
- Network calls happen only for agents, with a 2 second timeout and a circuit breaker.
- If the gate cannot answer, the page is served free.
- An agent is never charged for something that is not an article: your view runs first, and only a
200yourtollablehook accepts becomes a402. - The response body is never read or rewritten. A paid read only gains headers.
- Every
402and every paid200is markedCache-Control: private, no-store. - New sites start in observe mode: decisions are recorded and every request is served.
The wire protocol, for writing a runtime in another language: docs/protocol/in-app.md.
MIT licensed.
Metadata
Release files for naulon 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| naulon-0.1.0.tar.gz | 56.4 kB | With provenance | Details for naulon-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| naulon-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for naulon-0.1.0-py3-none-any.whl |
Total release size: 106.7 kB
Release files / naulon-0.1.0.tar.gz
| Download URL | naulon-0.1.0.tar.gz |
|---|---|
| Size | 56.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1193bbcfd2ff86da7f8f93e34dff3e8ab5bf350eae3ca3addf59b98ffc457fbb
|
|
BLAKE2b-256 checksum How to use checksums |
afaac5b264c422dcd452d05f593ad4635c99472a25024b6bb260b4e408c51d38
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.
Transparency logRelease files / naulon-0.1.0-py3-none-any.whl
| Download URL | naulon-0.1.0-py3-none-any.whl |
|---|---|
| Size | 50.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b3d1c1cb77c32515586084d6750eafb61263fc90b977bc1e944ca8e8d33e77c5
|
|
BLAKE2b-256 checksum How to use checksums |
9fb8e08765e92a80f50fc0b07afea39d46232ea7d2d3f7a12a77373bc83718d8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.
Transparency logSecurity for naulon 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for naulon-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 3, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.