Flask Parameters

API Reference

flask_parameters.inject_query_params([...])

Decorator that injects URL query parameters into flask a route function.

flask_parameters.inject_and_validate_query_params([...])

An extension of inject_query_params that also performs type checking of function arguments based on the signature of the function.

flask_parameters.exceptions.ArgsException(...)

Missing or extra arguments are supplied in the URL query parameters.

flask_parameters.exceptions.TypeCheckException(errors)

Some arguments failed the type check.

flask_parameters.exceptions.register_error_handlers(app)

Register error handlers on the flask app for the flask_parameters exceptions.

Example Usage

from flask_parameters import Flask

app = Flask(__name__)


@app.route("/foo")
def foo(arg, kwarg = 123) -> dict:
   return {"arg": arg, "kwarg": kwarg}


@app.route("/strict_foo")
def strict_foo(arg: str, kwarg: int = 123) -> dict:
   return {"arg": arg, "kwarg": kwarg}