Cerberus plugin for bottle
Project description
Currently under development, unstable version!
Cerberus plugin
Cerberus plugin for bottle
installation
Via pip: pip install bottle-cerberus
Or clone: git clone https://github.com/kianxineki/bottle-cerberus.git
example:
from bottle import get, install, run
from cerberus_plugin import CerberusPlugin
@get('/cerberus/<ex>', schemas={'body': {'ex': {'type': 'integer'}},
'url': {'ex': {'coerce': int}},
'query_string': {'ex': {'coerce': int}}})
def test_cerberus(ex):
from bottle import request
print("query_string", request.query['ex'], type(request.query['ex']))
print("url", ex, type(ex))
print("body", request.json.get('ex'), type(request.json.get('ex')))
install(CerberusPlugin())
run(host="0.0.0.0", port="9988")
Schemas
Optional keys
body: schema for request.json url: schema for url (no query string) query_string: schema for query strings
Schema
Github Schema: https://github.com/nicolaiarocci/cerberus Doc schema: http://docs.python-cerberus.org/en/stable/
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
bottle-cerberus-1.0.2.tar.gz
(2.6 kB
view details)
File details
Details for the file bottle-cerberus-1.0.2.tar.gz.
File metadata
- Download URL: bottle-cerberus-1.0.2.tar.gz
- Upload date:
- Size: 2.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1f5ba83cc36c9e7d4052756036e8c8d79774e80e413ed54419a3a4ac3c7b5834
|
|
| MD5 |
f1237cf0f031db695cc30289cc03809b
|
|
| BLAKE2b-256 |
139e920a2cec6e21b97535fcab6f88fe0f5709a6f1a19fa13526c726ab5fbb99
|