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

Uploaded Source

File details

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

File metadata

File hashes

Hashes for sanic-validation-0.3.0.tar.gz
Algorithm Hash digest
SHA256 dc516e01c3004df7245fdee6cd72443ac8088221c3e0b9069d1a4a5eaec1a7a1
MD5 7439a37dccc0bc6153c1c7c3a02b1567
BLAKE2b-256 c6e7fd1513e5952a564549fe3b9aa973478cb8d09293be8cde5daac538495e15

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