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

Uploaded Source

File details

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

File metadata

  • Download URL: sanic-validation-0.4.4.tar.gz
  • Upload date:
  • Size: 15.5 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.6.7

File hashes

Hashes for sanic-validation-0.4.4.tar.gz
Algorithm Hash digest
SHA256 938abf0c3f6ad55f488d1f994663d82c8cae8824f707fee8c26e71aeef397ac6
MD5 1426e23b3d5ad58804e9a7b60565f103
BLAKE2b-256 8704597b1c66865fc6018c4cdce539d1398a1fcd2343b2556a719862e97330ec

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 Pingdom Monitoring Sentry Error logging StatusPage Status page