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_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')
Building the documentation
Requirements
- Python
- Sphinx
- make
Building
python setup.py install
cd docs
make html
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.4.3.tar.gz
(15.8 kB
view details)
File details
Details for the file sanic-validation-0.4.3.tar.gz.
File metadata
- Download URL: sanic-validation-0.4.3.tar.gz
- Upload date:
- Size: 15.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.5.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e8bb9ec8d41d825a1368815b083d84992d1b7730b61a7d67b21a5fde83ea8ee3
|
|
| MD5 |
bc1efce13b61f71a97c0458ac7c1aa4b
|
|
| BLAKE2b-256 |
9b8775c02828113048405686b0653e2d32c52f09bcc3b911d276b6c2b2aad070
|