sanic-validation is an extension to sanic that simplifies validating request data.
pip install sanic-validation
Documentation is available at ReadTheDocs.
from sanic import Sanic
from sanic.response import json
from sanic_validation import validate_json
app = Sanic()
schema = {'name': {'type': 'string', 'required': True}}
@app.route('/')
@validate_json(schema)
async def hello_service(request):
return json({'message': 'Hello ' + request.json['name']})
app.run('0.0.0.0')
- Python
- Sphinx
- make
python setup.py install
cd docs
make html