Skip to main content
Archived

This project has been archived by its maintainers, and is no longer receiving any updates.

cazart

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.

Installation

cazart requires Python 3.6 or newer.

pip3 install cazart

Usage

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.

Release files for cazart 0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cazart 0.0.5
File Size Uploaded
cazart-0.0.5.tar.gz 3.6 kB Details

Release files / cazart-0.0.5.tar.gz

Download URL cazart-0.0.5.tar.gz
Size 3.6 kB
Tags Source
SHA-256 checksum
How to use checksums
ecb88195ca4eb9dadd47b4d06186dec1d5cee2032c9955f1abdc398bbda648ac
BLAKE2b-256 checksum
How to use checksums
4d194aea453d4dab74cabec96347aee4288dfa15dd9beafb93aaa2d87c761af2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page