Bottle + APISpec + Marshmallow integration
Project description
bottle-apispec
Simple plugin to easily enable integrate Bottle, APISpec and Marshmallow.
Example
from bottle import Bottle, run
from bottle_apispec import APISpecPlugin
from marshmallow import Schema
from marshmallow.fields import String
app = Bottle()
class MySchema(Schema):
id = String()
value = String()
@app.get('/')
def index():
"""API endpoint that return MySchema
---
get:
description: API endpoint that return MySchema
responses:
200:
description: It works!!!!
schema: MySchema
"""
data, error = MySchema.load('id', 'value')
return data
app.install(APISpecPlugin(
title='Example API',
version='1.0.0',
openapi_version='2.0',
scan_package='.')
)
run(app)
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-apispec-0.6.5.tar.gz
(2.7 kB
view hashes)
Built Distribution
Close
Hashes for bottle_apispec-0.6.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 67861a0bd59a1155ff570ab2d290b3f313f50258df29bd434464d425c7d2df55 |
|
MD5 | a78f463da4de511f56aadc21e301d817 |
|
BLAKE2b-256 | 56327a16935113d18cc8951d33a9f212406cbb4fd1491ebf366aec9c90b6a81e |