Une extension Flask simple pour gérer Whitelist et Blacklist d'IPs.
Project description
flask-ip-guard
Une extension Flask simple et légère pour restreindre l'accès à votre application via une Whitelist ou une Blacklist d'adresses IP.
Installation
pip install flask-ip-guard
Utilisation
Créez un fichier security.json à la racine de votre projet Flask :
{
"whitelist": [
{"ip": "127.0.0.1", "active": true, "description": "Localhost"}
],
"blacklist": []
}
Puis, dans votre application Flask (app.py) :
from flask import Flask
from flask_ip_guard import IPGuard
app = Flask(__name__)
# Configuration
app.config['IP_GUARD_MODE'] = 'WHITELIST' # ou 'BLACKLIST'
app.config['IP_GUARD_FILE'] = 'security.json'
# Initialisation
ip_guard = IPGuard(app)
@app.route('/')
def index():
return "Accès autorisé !"
Project details
Release history Release notifications | RSS feed
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 flask_ip_guard-0.1.0.tar.gz.
File metadata
- Download URL: flask_ip_guard-0.1.0.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bb424889819c1c8e11b9c6d83b34c7e9393a7f568d5e38f132496de54c40cee7
|
|
| MD5 |
1208f4c7d829b11b9eb5cd15283a055e
|
|
| BLAKE2b-256 |
288986f375e8fded6a09cf4fe5937c4a398b94b1e0bed9c1a570bab3551147ce
|
File details
Details for the file flask_ip_guard-0.1.0-py3-none-any.whl.
File metadata
- Download URL: flask_ip_guard-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f6152abf8508ed44dc1703f62ca186486dcaccdbaaf838c46d82cc5f3d204817
|
|
| MD5 |
0ba98d84fb90374deadf907e4bb85612
|
|
| BLAKE2b-256 |
785edc8bc59f924156d8672df0282b84ca7ca500a53ca3f3839bf40d2ac7d844
|