Request validation for aiohttp
Project description
aiohttp-valera-validator
Installation
$ pip3 install aiohttp-valera-validator
Usage
from aiohttp.web import Application, json_response, route, run_app
from district42 import schema
from aiohttp_valera_validator import validate
ParamsSchema = schema.dict({
"q": schema.str.len(1, ...)
})
@validate(params=ParamsSchema)
async def handler(request):
q = request.query["q"]
return json_response({"q": q})
app = Application()
app.add_routes([route("GET", "/users", handler)])
run_app(app)
// http /users?q=Bob
{
"q": "Bob"
}
// http /users
{
"errors": [
"Value <class 'str'> at _['q'] must have at least 1 element, but it has 0 elements"
]
}
Fore more information read Valera Docs
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 Distribution
Built Distribution
Close
Hashes for aiohttp-valera-validator-0.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 15cc9e6ed8f2ac9543362b3f59fdd794e8c0a6f5cb199a1472941c2d132c0434 |
|
MD5 | 5bb6aed83404c1df65f84f8998844a37 |
|
BLAKE2b-256 | 277e7e94f48df975c6626ea0e2dc6c1073564b313db7b702357f3b496bdb4199 |
Close
Hashes for aiohttp_valera_validator-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b47c5317a78efaef82b0aca66b990279b0f8b3eba2a81e49a39b089538717ed3 |
|
MD5 | d603522a3bc68a3d2a9a06c08ae227d0 |
|
BLAKE2b-256 | c1a6ba23ea737f60584eb5484160b320c7ebcfdcea394e3f8fe6be9d92bbd900 |