Skip to main content

Python data validation with web in-mind

Project description

travis coverage pyver

Validation library for processing http endpoint arguments.

from flask import Flask

from covador import split, opt
from covador.flask import query_string

app = Flask(__name__)

@query_string(foo=opt(split(int), []))
def csv_argument(foo):
    return repr(foo)

# GET /?foo=1,2,3 -> [1, 2, 3]

if __name__ == '__main__':
  • Support for flask(0.x, 1.0.x, 1.1.x), django(1.x, 2.x), aiohttp(2.x, 3.x), tornado(3.x, 4.x, 5.x, 6.x) and sanic(0.x, 18.x, 19.x).
  • Simple creating of custom query_string/form/params/json_body/args wrappers.
  • Multi dict support via item multi param.
  • Multi dict keys support via item src param.
  • Simple interface for custom validators/processors it’s just a callable.
  • Maps, typed Maps, Lists, Tuples, Enums.
  • Validation chains: opt(default=[]) | split(separator=' ') | List(int) | (lambda it: it[:10]) or more concise opt(split(int, separator=' '), []) | operator.itemgetter(slice(10)) — an optional argument of space separated integers and we need top 10 items from it and it is empty by default.
  • Literal schema: schema(foo=[{'boo': int}]), validates {'foo': [{'boo': 10}, {'boo': 20}]}.
  • Bytes/unicode aware.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for covador, version 0.10.1
Filename, size File type Python version Upload date Hashes
Filename, size covador-0.10.1.tar.gz (14.5 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page