一个falcon框架扩展,具有swagger、sqlalchemy和redis
falcon-swagger的Python项目详细描述
[![构建状态](https://travis-ci.org/dutradda/falcon-swagger.svg?branch=master)(https://travis ci.org/dutradda/falcon swagger)
[![覆盖状态](https://coveralls.io/repos/github/dutradda/falcon-swagger/badge.svg?branch=master)](https://coveralls.io/github/dutradda/falcon-swagger?branch=master)
falcon swagger
falcon framework(http://falconframework.org)扩展。
-提供redis模型基类(不带sqlalchemy)。
modelhttpmeta
class hellomodelmeta(modelhttpmeta):
'operationid':'得到你好',
'回复':{'200':{'description':'得到你'}
}
},
'/hello/world':{
'得到':{
'operationid':'得到你好世界',
'响应':{200':{'描述':'得到你好'}
}
}
}
def得到你好你(cls,req,resp):
you=req.context['parameters']['path']['name']
resp.body='你好{}!\ n.format(you)
def get_hello_world(cls,req,resp):
resp.body='你好世界!\ n'
类hellomodel(元类=hellomodelmeta):
通过
```````````bash
``bash
gunicorn gonicorn golicorn golicorn golicorn world:8000/hello/world
````````bash
``` bash
curl-i localhost:8000/hello/world
````````br/>```text
http/1.1 200 OK
server:gunicorn/19.6.0
```````````````````````````````````````````````````````utf-8
你好,世界!
```
``bash
curl-i localhost:8000/hello/you/diogo
````
``text
http/1.1200 ok
server:gunicorn/19.6.0
连接:关闭
内容长度:13
内容类型:application/json;charset=utf-8
hello diogo!
```
``bash
curl-i localhost:8000/swagger.json
```
``json
http/1.1 200确定
server:gunicorn/19.6.0
connection:close
content长度:672
content type:application/json;charset=utf-8
` `
“swagger”:“2.0”,
“paths”路径路径路径:2.0“{
”“/hello/world”:{
“获取”:{
“operationid”:“hellomodel.get_hello_world”,
“responses”:{
“200”:{
“description”:“got hello”
}
}
}
}
},
“/hello/you/{name}”:{
“get”:{
“operationid”:“hellomodel.get_hello_you”,
“responses”:{
“200”:{
“description”:“got you”
}
},
“parameters”:[
{
“in”:“path”,
“type”:“string”,
“required”:true,
“name”:“name”
}
]
}
}
}
},
“info”:{
“title”:“hello api”,
“version”:“1.0.0”
}
}
```
[![覆盖状态](https://coveralls.io/repos/github/dutradda/falcon-swagger/badge.svg?branch=master)](https://coveralls.io/github/dutradda/falcon-swagger?branch=master)
falcon swagger
falcon framework(http://falconframework.org)扩展。
-提供redis模型基类(不带sqlalchemy)。
modelhttpmeta
class hellomodelmeta(modelhttpmeta):
'operationid':'得到你好',
'回复':{'200':{'description':'得到你'}
}
},
'/hello/world':{
'得到':{
'operationid':'得到你好世界',
'响应':{200':{'描述':'得到你好'}
}
}
}
def得到你好你(cls,req,resp):
you=req.context['parameters']['path']['name']
resp.body='你好{}!\ n.format(you)
def get_hello_world(cls,req,resp):
resp.body='你好世界!\ n'
类hellomodel(元类=hellomodelmeta):
通过
``bash
gunicorn gonicorn golicorn golicorn golicorn world:8000/hello/world
````````bash
``` bash
curl-i localhost:8000/hello/world
````````br/>```text
http/1.1 200 OK
server:gunicorn/19.6.0
```````````````````````````````````````````````````````utf-8
你好,世界!
```
``bash
curl-i localhost:8000/hello/you/diogo
````
``text
http/1.1200 ok
server:gunicorn/19.6.0
连接:关闭
内容长度:13
内容类型:application/json;charset=utf-8
hello diogo!
```
``bash
curl-i localhost:8000/swagger.json
```
``json
http/1.1 200确定
server:gunicorn/19.6.0
connection:close
content长度:672
content type:application/json;charset=utf-8
` `
“swagger”:“2.0”,
“paths”路径路径路径:2.0“{
”“/hello/world”:{
“获取”:{
“operationid”:“hellomodel.get_hello_world”,
“responses”:{
“200”:{
“description”:“got hello”
}
}
}
}
},
“/hello/you/{name}”:{
“get”:{
“operationid”:“hellomodel.get_hello_you”,
“responses”:{
“200”:{
“description”:“got you”
}
},
“parameters”:[
{
“in”:“path”,
“type”:“string”,
“required”:true,
“name”:“name”
}
]
}
}
}
},
“info”:{
“title”:“hello api”,
“version”:“1.0.0”
}
}
```