Validation for sanic endpoints
Project description
sanic-validation
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
Release history Release notifications | RSS feed
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)