Skip to main content

sanic-validation

Build Status

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.3.1.tar.gz (16.0 kB view details)

Uploaded Source

File details

Details for the file sanic-validation-0.3.1.tar.gz.

File metadata

File hashes

Hashes for sanic-validation-0.3.1.tar.gz
Algorithm Hash digest
SHA256 c66521320e794cd92b13e5b8c68d15aae97897e28c98b880674c62257a0d0d34
MD5 418aaf052be02279b0a176ade1a4f6c4
BLAKE2b-256 94b93d2b6bf0214a55a0cb59c0fcc90d8dbb854f22049b42fa7119927ea476a8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page