Skip to main content

Flask + Schema = Cazart!

Project description


license Build Status

Flask + schema = cazart!

cazart is a small helper for writing schematized JSON endpoints with Flask. It rolls schema into Flask's route decorator, allowing for one-shot route and schema specification.


cazart requires Python 3.6 or newer.

pip3 install cazart


To use cazart, just swap your Flask instance out for a Cazart one:

from cazart import Cazart

app = Cazart(__name__)

You can access all of Flask's baseline functionality (including non-validated routes) via app.flask.

Then, use app.route to specify a combination route and schema:

from cazart import Cazart
from schema import Schema, Or

app = Cazart(__name__)

@app.route("/cazart", schema=Schema({"name": Or("alice", "bob", "mary")}))
def cazart(res):
    print(f"my verified payload is {res}!")
    return ("ok", 200)

See the examples for full usage examples, including custom error handling and dispatching to different schemas on a route based on HTTP method.

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

cazart-0.0.5.tar.gz (3.6 kB view hashes)

Uploaded Source

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