sample.py
1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# coding=utf-8
#author: 4N
#createtime: 2020/8/27
#email: nheweijun@sina.com
import os
from app.util.component.ApiTemplate import ApiTemplate
from flask import current_app
class Api(ApiTemplate):
def para_check(self):
if self.para.get("content") is None:
raise Exception("缺乏content参数")
def log(self):
current_app.logger.info('info log')
def process(self):
result=dict()
result.update(self.para)
result["root_path"] = os.path.dirname(current_app.instance_path)
return result
api_doc= {
"tags": ["测试接口"],
"description": "测试接口",
"parameters": [
{"name": "content",
"in": "query"}
],
"responses": {
200: {
"schema": {
"properties": {
"content": {
"type": "string",
"description": "The name of the user"
}
}
}
}
}
}