Skip to main content

Cerberus plugin for bottle

Project description

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 bottle_cerberus 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


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.3.tar.gz (2.6 kB view details)

Uploaded Source

File details

Details for the file bottle-cerberus-1.0.3.tar.gz.

File metadata

File hashes

Hashes for bottle-cerberus-1.0.3.tar.gz
Algorithm Hash digest
SHA256 96719d3a8cd374a585897a79bde17863faa4a6ef82bbaebf7cf8e9723837a9c5
MD5 4d21f8b01d63f931782eae57a331b87c
BLAKE2b-256 ddee55d9a95feec812b9c7524eac578e5a28aed89bf6b6686579ed9744b7e78c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page