Skip to main content

flask-noAI

A simple Flask extension to block AI crawlers.

How it works

Flask-noAI adds certain rules to robots.txt expecting it to be respected, and if a violation of those rules is detected, content access is blocked.

How to use it

import flask_noai

flask_noai.noai(app)

Yes, it's this easy.

You can even do it like this:

from flask import Flask
from flask_noai import noai

app = noai(Flask(__name__))

Note: noai() does not need to be called at initialization of the app. It can be called later since it only registers route handlers:

...
...
...
app = Flask(__name__)
...
...
...
noai(app)
...
...
...

noai() returns back the original application to allow for chaining. noai() is basically the same as init_app() in most extensions except that noai() is mainly a route register rather than a "true" flask extension, which is why I chose the naming of noai() over init_app()!

Handling

  • If you want to have a custom message when unauthorised scraping was detected, use noai(..., on_detect="...")
  • If you want to return a non-200 code when it was detected, use noai(..., code=401) or other codes.
  • You can still add custom robots.txt by simply creating a route.
  • You should not make /robots, /robots/, or /robots.txt/ routes since they are handled by this extension.

Metadata

Release files for flask-noai 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for flask-noai 1.1.0
File Interpreter ABI Platform Actions
flask_noai-1.1.0-py2.py3-none-any.whl Python 2, Python 3 none any Details for flask_noai-1.1.0-py2.py3-none-any.whl

Release files / flask_noai-1.1.0-py2.py3-none-any.whl

Download URL flask_noai-1.1.0-py2.py3-none-any.whl
Size 16.2 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
0b1e95099b48315156104b505fc2a760b48e85dcb59e274e2ae77aad4368ac5d
BLAKE2b-256 checksum
How to use checksums
93b9aa82e8e579e50d84cca4fb656eeb22e33a6a271f24b5fcac9be1f42e5d27
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.13.2

Security for flask-noai 1.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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A 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.

Release history Release notifications | RSS feed

This release

1.1.0 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page