A friendly library for parsing HTTP request arguments, with built-in support for popular web frameworks, including Flask, Django, Bottle, Tornado, Pyramid, webapp2, Falcon, and aiohttp.
Python
Clone or download
Permalink
Failed to load latest commit information.
docs Pass schema instance to error handlers Jul 15, 2018
examples Use flake8-bugbear; use async def coroutines Jul 9, 2018
tests Pass schema instance to error handlers Jul 15, 2018
webargs Bump version and update changelog Jul 15, 2018
.gitignore Ignore built README May 4, 2018
.pre-commit-config.yaml Format code and docs with black+blacken-docs+pre-commit Jul 9, 2018
.pyup.yml fix .pyup.yml Feb 5, 2018
.readthedocs.yml Build docs in Python 3.6 May 8, 2018
.travis.yml Bump required marshmallow version Jul 10, 2018
AUTHORS.rst Add @Reskov to AUTHORS; update changelog; bump dev version Jul 8, 2018
CHANGELOG.rst Bump version and update changelog Jul 15, 2018
CONTRIBUTING.rst Format code and docs with black+blacken-docs+pre-commit Jul 9, 2018
LICENSE Bump dev version; update changelog; update year; add @lafrech to AUTHORS Jan 8, 2017
MANIFEST.in fat initial commit Feb 14, 2014
NOTICE Fix status_code behavior for aiohttp and falcon; expand test coverage Apr 5, 2016
README.rst Format code and docs with black+blacken-docs+pre-commit Jul 9, 2018
dev-requirements-py3.txt Use flake8-bugbear; use async def coroutines Jul 9, 2018
dev-requirements.txt Merge pull request #248 from sloria/pyup-update-tox-3.1.1-to-3.1.2 Jul 12, 2018
setup.cfg Address a few warnings Jul 10, 2018
setup.py Bump required marshmallow version Jul 10, 2018
tasks.py Format code and docs with black+blacken-docs+pre-commit Jul 9, 2018
tox.ini Drop support for Python 3.4 Jul 8, 2018

README.rst

webargs

https://travis-ci.org/sloria/webargs.svg?branch=pypi marshmallow 3 compatible code style: black

Homepage: https://webargs.readthedocs.io/

webargs is a Python library for parsing and validating HTTP request arguments, with built-in support for popular web frameworks, including Flask, Django, Bottle, Tornado, Pyramid, webapp2, Falcon, and aiohttp.

from flask import Flask
from webargs import fields
from webargs.flaskparser import use_args

app = Flask(__name__)

hello_args = {"name": fields.Str(required=True)}


@app.route("/")
@use_args(hello_args)
def index(args):
    return "Hello " + args["name"]


if __name__ == "__main__":
    app.run()

# curl http://localhost:5000/\?name\='World'
# Hello World

Install

pip install -U webargs

webargs supports Python >= 2.7 or >= 3.5.

Documentation

Full documentation is available at https://webargs.readthedocs.io/.

Project Links

License

MIT licensed. See the LICENSE file for more details.