webargs-sanic provides integration of Webargs with Sanic applications
Project description
webargs-sanic
Sanic integration with Webargs
webargs is a Python library for parsing and validating HTTP request arguments, with built-in support for popular web frameworks.
webargs-sanic allows you to use it for Sanic apps.
Example Code
from sanic import Sanic
from webargs import fields
from webargs_sanic.sanicparser import use_args
app = Sanic(__name__)
hello_args = {
'name': fields.Str(required=True)
}
@app.route('/')
@use_args(hello_args)
async def index(args):
return 'Hello ' + args['name']
Installing
It is easy to do from pip
pip install webargs-sanic
or from sources
git clone git@github.com:EndurantDevs/webtest-sanic.git
cd webtest-sanic
python setup.py install
Running the tests
To be sure everything is fine before installation from sources, just run:
pip -r requirements.txt
and then
python setup.py test
Or
pytest tests/
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Close
Hashes for webargs_sanic-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c3a72b40e7768f3456879dac60564861e083923b60f5f3ebf5362d011dc5d80e |
|
MD5 | 0332b5b6094a0e209f1a6325f2e7308a |
|
BLAKE2b-256 | b392ba9a4c6bae9d7bb19f22c6c7d1bb40422d97625e5154893cf610abad42aa |