Skip to main content

Validation for sanic endpoints

Project description

sanic-validation

PyPI PyPI - Python Version Build Status Read the Docs

sanic-validation is an extension to sanic that simplifies validating request data.

Installation

pip install sanic-validation

Documentation

Documentation is available at ReadTheDocs.

Usage example

from sanic import Sanic
from sanic.response import json
from sanic_validation import validate_args

app = Sanic('demo-app')

schema = {'name': {'type': 'string', 'required': True}}


@app.route('/')
@validate_args(schema)
async def hello(request):
    return json({'message': 'Hello ' + request.args['name']})

app.run('0.0.0.0')

Building the documentation

Requirements

  • Python
  • Sphinx
  • make

Building

python setup.py install
cd docs
make html

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

sanic-validation-0.5.1.tar.gz (15.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