Skip to main content

No project description provided

Project description

Flask Parameters

This library defines some decorators to be used with Flask to inject URL query parameters as arguments into route functions. You can optionally perform type checking of the parameters based on the signature of the route function.

Documentation

Example Usage

import flask

from flask_parameters import inject_query_params
from flask_parameters import inject_and_validate_query_params
from flask_parameters import register_error_handlers

app = flask.Flask(__name__)
register_error_handlers(app)


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


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

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-parameters-0.0.2.tar.gz (4.6 kB view hashes)

Uploaded Source

Built Distribution

flask_parameters-0.0.2-py3-none-any.whl (5.8 kB view hashes)

Uploaded Python 3

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