Skip to main content

Flask-Guardian


About

Chainable request-validation rules for Flask, inspired by Joi.

This is an earlier library. Validate behavior against your Flask version before production use. The repository’s LICENSE file is currently empty; licensing needs clarification before redistribution.

Installation

Use pip for installation

pip install flask-guardian

How to use

Create your rule

from flask_guardian.rules import Rules
from flask_guardian.validator import Validator

my_rules = {
  "login": Rules().Required().String().Max(20),
  "password": Rules().Required().String().Min(8).Max(120)
}

Add the middleware inside your route

@app.route("/login", methods=["POST"])
@Validator(my_rules)
def login_():
  '''your code here'''

Rules

.String()

Verify if the parameter is a string.

.Integer()

Verify if the parameter is an integer.

.Email()

Using a regex, verify if the parameter is conform with email format.

.Min(x)

Verify if the parameter len is more than x.

.Max(x)

Verify if the parameter len is less or equal than x.

.Contains([x, y, z])

Verify if the parameter contains at least one argument of the array.

.notContains([x, y, z])

Verify if the parameter not contains any argument of the array.

.Equal(x)

Verify if the parameter equal x.

.notEqual(x)

Verify if the parameter not equal x.

Metadata

Release files for flask-guardian 0.1.2

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

Source distribution (sdist)

Source distribution for flask-guardian 0.1.2
File Size Uploaded
flask_guardian-0.1.2.tar.gz 4.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for flask-guardian 0.1.2
File Interpreter ABI Platform
flask_guardian-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 8.7 kB

Release files / flask_guardian-0.1.2.tar.gz

Download URL flask_guardian-0.1.2.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
56775c981eb974c7cedb6660744ca230514c68cc32b60bbca1df6ed67336fe7e
BLAKE2b-256 checksum
How to use checksums
5bd5f8503d875a22cb28b3837d5c754835b71efc21a54812ec32e5d40bc3a496
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / flask_guardian-0.1.2-py3-none-any.whl

Download URL flask_guardian-0.1.2-py3-none-any.whl
Size 4.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ccbe11be3a126d0a34e982a62881a98d1b663a2e7a7c8737004a051ea61656be
BLAKE2b-256 checksum
How to use checksums
aabfb2acd7167a534445281b72e9578a4e26ecac03e227ab29346b0b4f301ac0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

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