Skip to main content

Protect against bots and DDoS attacks

Project description

flask-Humanify

A strong bot protection system for Flask with many features: rate limiting, special rules for users, web crawler detection, and automatic bot detection.

Github PyPI Libraries.io


from flask import Flask
from flask_Humanify import Humanify

app = Flask(__name__)
humanify = Humanify(app, challenge_type="one_click", captcha_dataset="ai_dogs")

# Register the middleware to deny access to bots
humanify.register_middleware(action="challenge")

@app.route("/")
def index():
    """
    A route that is protected against bots and DDoS attacks.
    """
    return "Hello, Human!"

if __name__ == "__main__":
    app.run()

Not using the middleware:

@app.route("/")
def index():
    """
    A route that is protected against bots and DDoS attacks.
    """
    if humanify.is_bot:
        return humanify.challenge()
    return "Hello, Human!"

Usage

Installation

Install the package with pip:

pip install flask-humanify --upgrade

Import the extension:

from flask_humanify import Humanify

Add the extension to your Flask app:

app = Flask(__name__)
humanify = Humanify(app)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flask_humanify-0.2.0.tar.gz (49.5 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flask_humanify-0.2.0-py3-none-any.whl (49.7 MB view details)

Uploaded Python 3

File details

Details for the file flask_humanify-0.2.0.tar.gz.

File metadata

  • Download URL: flask_humanify-0.2.0.tar.gz
  • Upload date:
  • Size: 49.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for flask_humanify-0.2.0.tar.gz
Algorithm Hash digest
SHA256 f77ad691ea7eb213293a62fc58b7025d81408dc3c70e98135313e763e41ea615
MD5 5a6eb166c50aef4791bad737930233f2
BLAKE2b-256 8b2aeaddc60c496dcbb8e48ab1e18d5488d24a93d7152385084a087dde52c7a5

See more details on using hashes here.

File details

Details for the file flask_humanify-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: flask_humanify-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 49.7 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for flask_humanify-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8983699ea1c2fe233da82ed77bd4929600618b418112ec960fb0a3145339c755
MD5 85da9541704a10a7b548078780ff6b0d
BLAKE2b-256 b3964a0ab6b3d63ad2736a795444932aa6b362632ac4a3682d773c3cd220fb15

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page