网络编程
位置:首页>> 网络编程>> Python编程>> 使用apiDoc实现python接口文档编写

使用apiDoc实现python接口文档编写

作者:Gary5556  发布时间:2023-10-23 21:28:40 

标签:apiDoc,python,接口文档

apiDoc的安装


npm install apidoc -g

点击官方文档

生成api的终端命令:apidoc -i 代码所在路径-o 生成文件的路径

接口文档的编写

文件的简介

project的介绍写在单独的json文件中apidoc.json:


{ "name": "project_name",

"version": "0.1.0",

"description": "who am i ,what i can do ",

"title": " title of the html that generated by apiDoc",

"sampleUrl" : "https://127.0.0.1:8000"}

具体api的书写模版


"""
@api {methods} url description
@apiName unique_name
@apiGroup group

@apiParam {type} field description

@apiSuccessExample {json} Success-Response:
HTTP/1.1 200 OK
 {
 "errno":200,
 "errmsg":errmsg,
 }
@apiError errortype description.
@apiErrorExample {json} Error-Response:
HTTP/1.1 200 OK
{
 "errno":401
 "errmsg": "UserNotFound"
 }
"""

来源:https://blog.csdn.net/zjh_lll/article/details/80093165

0
投稿

猜你喜欢

手机版 网络编程 asp之家 www.aspxhome.com