Skip to main content
Join the official 2020 Python Developers SurveyStart the survey!

HTTP spam security for Flask.

Project description

IpBan: HTTP spam security for Flask

|PyPI Version|

IpBan is a Flask extension that can help protect against ip locations spamming url requests
against unknown pages. Often this is to search for security issues.

The default configuration:

- 50 attempts before ban
- 1 hour blocking period

Installation & Basic Usage

Install via `pip <>`_:


pip install flask-ipban

After installing, wrap your Flask app with a ``IpBan``:

.. code:: python

from flask import Flask
from flask_ipban import IpBan

app = Flask(__name__)

Enclosed is a small example application


- ``ban_count``, default ``50``, Number of observations before banning
- ``ban_minutes``, default ``60``, Number of minutes ip address is banned
- ``ip_ban.block(ip_address, permanent=True)`` - block the specific address forever
- ``ip_ban.add(reason='spite')`` - increase the observation for the current request ip

Per-view options

Sometimes you want to change the policy for a specific view. The
``force_https``, ``frame_options``, ``frame_options_allow_from``, and
``content_security_policy`` options can be changed on a per-view basis.

.. code:: python

from flask import Flask
from flask_ipban import IpBan, ALLOW_FROM

app = Flask(__name__)
ip_ban = IpBan(app)

def normal():
return 'Normal'

- Apache 2.0

.. |PyPI Version| image::

Project details

Download files

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

Files for flask-ipban, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size flask_ipban-0.1.0-py2.py3-none-any.whl (8.9 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size flask-ipban-0.1.0.tar.gz (4.0 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page