Skip to main content

Validation for sanic endpoints

Project description

sanic-validation

PyPI PyPI - Python Version Build Status Read the Docs

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_args

app = Sanic('demo-app')

schema = {'name': {'type': 'string', 'required': True}}


@app.route('/')
@validate_args(schema)
async def hello(request):
    return json({'message': 'Hello ' + request.args['name']})

app.run('0.0.0.0')

Building the documentation

Requirements

  • Python
  • Sphinx
  • make

Building

python setup.py install
cd docs
make html

Project details


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

Uploaded Source

File details

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

File metadata

  • Download URL: sanic-validation-0.5.1.tar.gz
  • Upload date:
  • Size: 15.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.6.7

File hashes

Hashes for sanic-validation-0.5.1.tar.gz
Algorithm Hash digest
SHA256 0f8b5dbd9c47a4593d9d3028e427d9cc3e46944ca8306c2d33d125cdbef44c5e
MD5 f82e1aa5e8a82f4aa07c96f8debb27dc
BLAKE2b-256 36cfee4b5f57da3b036b4f1e8716a913201d4ca5ba47bdd3810360f21b09d0f0

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page