小船用蜡笔

bottle-cerberus的Python项目详细描述


Cerberus插件

Cerberus瓶子插件

安装

通过PIP:^{TT1}$

或克隆:git clone https://github.com/agalera/bottle-cerberus.git

示例:

frombottleimportget,install,runfrombottle_cerberusimportCerberusPlugin,SchemaclassExampleSchema(Schema):defschema(self):return{'ex':{'type':'integer'},'url':{'ex':{'coerce':int}}}classQuerySchema(Schema):defschema(self):return{'ex':{'coerce':int}}@get('/cerberus/<ex>',schemas={'body':ExampleSchema(),'query_string':QuerySchema())deftest_cerberus(ex):frombottleimportrequestprint("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")

模式

可选键

body:schema for request.json

url:url的架构(无查询字符串)

查询字符串:查询字符串的架构

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java log4j找不到log4jtest。房产?   我在java线程“awteventque1”中获得异常。lang.NullPointerException   java为什么在使用完整路径从文件系统读取文件时出错?   java如何迭代所有注册表项?   java中的安卓 Opencv SVM未正确训练   多线程Java ThreadPoolExecutor关闭特定线程?   如何使用Java NIO CreateDirectory方法设置目录所有者组?   java NatTable混合了固定宽度的列和可调整大小的填充剩余空间   java如何删除特定网络,即使该网络是由安卓上的其他设备创建的?   java Guava toJavaUtil()不存在   java对许多常量使用枚举是有效的memorywise?   java是否可以使用坐标定位JButton?   从WSDL生成java代码导致异常   java如何在安卓中导出javadoc   爬行JAX中的java NoClassDefFoundError错误   java为片段中的文本视图设置区域设置   发送最后一条消息后发生Java RMI RemoteException