Skip to main content

A small flask package

Project description

Flask-Guardian


About

This Package is inspired by Joi

Installation

Use pip for installation

pip install flask-guardian

How to use

Create your rule

from flask_guardian.rules import Rules

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.

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_guardian-0.1.1.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

flask_guardian-0.1.1-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file flask_guardian-0.1.1.tar.gz.

File metadata

  • Download URL: flask_guardian-0.1.1.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.15

File hashes

Hashes for flask_guardian-0.1.1.tar.gz
Algorithm Hash digest
SHA256 75be4a55b9452c99563a41900dac563d69ce63dcb05c60528ff750c9b9095c76
MD5 ac9b0f332ffa8818e43ae6173536e4b0
BLAKE2b-256 795e1f1a09b2a69ff49e373354350e9029e9d0d82babcfdf3a343d26b5578aeb

See more details on using hashes here.

File details

Details for the file flask_guardian-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for flask_guardian-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ff4fd7ac61fbe4c702e0cb3b504c02beffcde85f43dbcd21b72b82cdc2c3a7cb
MD5 285a6799134c10423612091fbec04c9d
BLAKE2b-256 dd4fff246660b29c57e70fa516bfd16c03f84ee891e68b205084456ca10db2fc

See more details on using hashes here.

Supported by

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