Skip to main content

marshmallow plugin for bottle

Project description

Marshmallow plugin

Marshmallow plugin for bottle

installation

Via pip: pip install bottle-marshmallow

Or clone: git clone https://github.com/agalera/bottle-marshmallow.git

example:

from bottle import post, install, run
from bottle_marshmallow import MarshmallowPlugin
from marshmallow import Schema, fields


class ExampleSchema(Schema):
    name = fields.Str()


class QuerySchema(Schema):
    name = fields.Str()


@post('/marshmallow/<ex>', schemas={'body': ExampleSchema,
                                    'query_string': QuerySchema})
def test_marshmallow(validated, ex):
    print(validated)

install(MarshmallowPlugin())
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

marshmallow: http://marshmallow.readthedocs.io

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

Uploaded Source

File details

Details for the file bottle-marshmallow-1.0.5.tar.gz.

File metadata

  • Download URL: bottle-marshmallow-1.0.5.tar.gz
  • Upload date:
  • Size: 2.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Python-urllib/3.7

File hashes

Hashes for bottle-marshmallow-1.0.5.tar.gz
Algorithm Hash digest
SHA256 deb91abd582d83d24e91b77fab74ac3c136a680097d9095f3353adf1c3dec836
MD5 cf636ceb03566e5ecb1bf5003af69499
BLAKE2b-256 d7fa0c5ca13841d7b0d85fbc73bbd11f5eaf4cdee1ca56382d9f16763328fb20

See more details on using hashes here.

Supported by

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