flask-guardian-0.1.1


توضیحات

A small flask package
ویژگی مقدار
سیستم عامل OS Independent
نام فایل flask-guardian-0.1.1
نام flask-guardian
نسخه کتابخانه 0.1.1
نگهدارنده []
ایمیل نگهدارنده []
نویسنده -
ایمیل نویسنده Antonin Alves <antonin@alors-la.center>
آدرس صفحه اصلی -
آدرس اینترنتی https://pypi.org/project/flask-guardian/
مجوز -
# Flask-Guardian --- ## About This Package is inspired by [Joi](https://joi.dev/) ## Installation **Use pip for installation** ```sh pip install flask-guardian ``` ## How to use ### Create your rule ```py 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 ```py @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.


زبان مورد نیاز

مقدار نام
>=3.7 Python


نحوه نصب


نصب پکیج whl flask-guardian-0.1.1:

    pip install flask-guardian-0.1.1.whl


نصب پکیج tar.gz flask-guardian-0.1.1:

    pip install flask-guardian-0.1.1.tar.gz