瓶用棉花糖插件
bottle-marshmallow的Python项目详细描述
棉花糖插件
瓶用棉花糖插件
安装
通过PIP:^{TT1}$
或克隆: git clone https://github.com/agalera/bottle-marshmallow.git
示例:
frombottleimportpost,install,runfrombottle_marshmallowimportMarshmallowPluginfrommarshmallowimportSchema,fieldsclassExampleSchema(Schema):name=fields.Str()classQuerySchema(Schema):name=fields.Str()@post('/marshmallow/<ex>',schemas={'body':ExampleSchema,'query_string':QuerySchema})deftest_marshmallow(validated,ex):print(validated)install(MarshmallowPlugin())run(host="0.0.0.0",port="9988")
模式
可选键
body:schema for request.json
url:url的架构(无查询字符串)
查询字符串:查询字符串的架构