Skip to main content

Cerberus plugin for bottle

Project description

Cerberus plugin

Cerberus plugin for bottle


Via pip: pip install bottle-cerberus

Or clone: git clone


from bottle import get, install, run
from bottle_cerberus import CerberusPlugin, Schema

class ExampleSchema(Schema):
    def schema(self):
        return {
            'ex': {'type': 'integer'},
            'url': {'ex': {'coerce': int}}

class QuerySchema(Schema):
    def schema(self):
        return {'ex': {'coerce': int}}

@get('/cerberus/<ex>', schemas={'body': ExampleSchema(),
                                'query_string': QuerySchema())
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')))

run(host="", port="9988")


Optional keys

body: schema for request.json

url: schema for url (no query string)

query_string: schema for query strings

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 bottle-cerberus, version 1.1.3
Filename, size File type Python version Upload date Hashes
Filename, size bottle-cerberus-1.1.3.tar.gz (2.9 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