A-Api-Server


NameA-Api-Server JSON
Version 1.1.7 PyPI version JSON
download
home_pagehttps://github.com/zhuifengshen/a-api-server
Summary自建一个Resful风格的接口自助服务,方便API自动化测试工具的开发与调试!
upload_time2023-08-04 07:18:10
maintainer
docs_urlNone
authordevin
requires_python>=2.7, <4
licenseMIT
keywords apiserver api mockserver api test 接口测试 接口自动化测试
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # A Api Server

## 一、概述

A api server,是一个 Resful 风格的简易 API 服务,提供了对用户账号进行增删改查(CRUD)功能的接口服务,包含了接口的签名校验机制,方便 API 自动化测试工具的开发与调试!

#### 1. 本地启动服务

- (1)命令行启动

```
pip install A-Api-Server
a_api_server 自定义端口号(默认5000)
```

- (2)clone 源码启动

```
pip install gunicorn flask
cd a_api_server
python api_server.py 自定义端口号(默认5000)
```

(注意:兼容 Python2 和 Python3)

### 2. 服务端启动服务,推荐使用 gunicorn

```
cd a_api_server
gunicorn api_server:app -p api_server.pid -b 0.0.0.0:5000 -w 4 -D

服务端关闭服务的命令如下:
kill -HUP `cat api_server.pid`
kill `cat api_server.pid`
```

### 3. 启动后访问地址

```
http://your.ip:5000
```

## 二、接口文档

### 1. API V1 接口说明

- 接口基准地址:http://your.ip:5000/
- 使用 HTTP Status Code 标识状态
- 数据返回格式统一使用 JSON
- API V1 认证统一使用 Token 认证
- 需要授权的 API ,必须在请求头中使用`device_sn`字段提供设备序列号和 `token` 字段提供访问令牌
- 全局请求头

| 参数名       | 参数类型 | 参数说明   | 备注                        |
| ------------ | -------- | ---------- | --------------------------- |
| Content-Type | String   | 内容类型   | application/json            |
| device_sn    | String   | 设备序列号 | 唯一设备标识符              |
| token        | String   | 访问令牌   | 拥有 token 的设备才有访问权 |

#### 1.1. 支持的请求方法

- GET(SELECT):从服务器取出资源(一项或多项)。
- POST(CREATE):在服务器新建一个资源。
- PUT(UPDATE):在服务器更新资源(客户端提供改变后的完整资源)。
- PATCH(UPDATE):在服务器更新资源(客户端提供改变的属性)。
- DELETE(DELETE):从服务器删除资源。
- HEAD:获取资源的元数据。
- OPTIONS:获取信息,关于资源的哪些属性是客户端可以改变的。

#### 1.2. 通用返回状态说明

| _状态码_ | _含义_                | _说明_                                              |
| -------- | --------------------- | --------------------------------------------------- |
| 200      | OK                    | 请求成功                                            |
| 201      | CREATED               | 创建成功                                            |
| 204      | DELETED               | 删除成功                                            |
| 400      | BAD REQUEST           | 请求的地址不存在或者包含不支持的参数                |
| 401      | UNAUTHORIZED          | 未授权                                              |
| 403      | FORBIDDEN             | 被禁止访问                                          |
| 404      | NOT FOUND             | 请求的资源不存在                                    |
| 422      | Unprocesable entity   | [POST/PUT/PATCH] 当创建一个对象时,发生一个验证错误 |
| 500      | INTERNAL SERVER ERROR | 内部错误                                            |

---

### 2. 具体接口说明

#### 2.1. 获取令牌

- 请求路径:/api/get-token
- 请求方法:post
- 请求头

| 参数名      | 参数类型 | 参数说明   | 备注 |
| ----------- | -------- | ---------- | ---- |
| User-Agent  | String   | 用户代理   |      |
| device_sn   | String   | 设备序列号 |      |
| os_platform | String   | 系统平台   |      |
| app_version | String   | 应用版本   |      |

- 请求参数

| 参数名 | 参数类型 | 参数说明 | 备注                     |
| ------ | -------- | -------- | ------------------------ |
| sign   | String   | 加密签名 | 根据请求头和密钥加密生成 |

- 响应参数

| 参数名  | 参数类型 | 参数说明 | 备注       |
| ------- | -------- | -------- | ---------- |
| success | Boolean  | 是否成功 |            |
| token   | String   | 访问令牌 | 长度 16 位 |

- 成功返回

```
状态码:200
响应体:
{
    'success': true,
    'token': "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1aW"
}
```

- 失败返回

```
状态码:403
响应体:
{
    'success': false,
    'msg': "Authorization failed!"
}
```

- 签名生成算法

```python
def get_sign(*args):
    SECRECT_KEY = 'YouMi'
	content = ''.join(args).encode('ascii')
	sign_key = SECRECT_KEY.encode('ascii')
	sign = hmac.new(sign_key, content, hashlib.sha1).hexdigest()
	return sign

sign = get_sign(user_agent, device_sn, os_platform, app_version)

```

#### 2.2. 新建用户

- 请求路径:/api/users/:id
- 请求方法:post
- 请求参数

| 参数名   | 参数类型 | 参数说明 | 备注 |
| -------- | -------- | -------- | ---- |
| id       | Int      | 用户 ID  |      |
| name     | String   | 用户名   |      |
| password | String   | 密码     |      |

- 响应参数

| 参数名  | 参数类型 | 参数说明 | 备注 |
| ------- | -------- | -------- | ---- |
| success | Boolean  | 是否成功 |      |
| msg     | String   | 说明信息 |      |

- 成功返回

```
状态码:201
响应体:
{
    'success': true,
    'msg': "user created successfully."
}
```

- 失败返回

```
状态码:422
响应体:
{
    'success': false,
    'msg': "user already existed."
}
```

#### 2.3. 根据 ID 查询用户信息

- 请求路径:/api/users/:id
- 请求方法:get
- 响应参数

| 参数名   | 参数类型 | 参数说明 | 备注 |
| -------- | -------- | -------- | ---- |
| success  | Boolean  | 是否成功 |      |
| name     | String   | 用户名   |      |
| password | String   | 密码     |      |

- 成功返回

```
状态码:200
响应体:
{
    'success': true,
    'data': {
        'name': 'admin',
        'password': '123456'
    }
}
```

- 失败返回

```
状态码:404
响应体:
{
    'success': fasle,
    'data': {}
}
```

#### 2.4. 更新用户信息

- 请求路径:/api/users/:id
- 请求方法:put
- 请求参数

| 参数名   | 参数类型 | 参数说明 | 备注 |
| -------- | -------- | -------- | ---- |
| id       | Int      | 用户 ID  |      |
| name     | String   | 用户名   |      |
| password | String   | 密码     |      |

- 响应参数

| 参数名  | 参数类型 | 参数说明 | 备注 |
| ------- | -------- | -------- | ---- |
| success | Boolean  | 是否成功 |      |
| data    | Dict     | 用户信息 |      |

- 成功返回

```
状态码:200
响应体:
{
    'success': true,
    'data': {
        'name': 'admin',
        'password': '123456'
    }
}
```

- 失败返回

```
状态码:404
响应体:
{
    'success': fasle,
    'data': {}
}
```

#### 2.5. 删除用户信息

- 请求路径:/api/users/:id
- 请求方法:delete
- 请求参数

| 参数名 | 参数类型 | 参数说明 | 备注 |
| ------ | -------- | -------- | ---- |
| id     | Int      | 用户 ID  |      |

- 响应参数

| 参数名  | 参数类型 | 参数说明 | 备注 |
| ------- | -------- | -------- | ---- |
| success | Boolean  | 是否成功 |      |
| data    | Dict     | 用户信息 |      |

- 成功返回

```
状态码:200
响应体:
{
    'success': true,
    'data': {
        'name': 'admin',
        'password': '123456'
    }
}
```

- 失败返回

```
状态码:404
响应体:
{
    'success': fasle,
    'data': {}
}
```

#### 2.6. 用户数据列表

- 请求路径:/api/users
- 请求方法:get
- 响应参数

| 参数名  | 参数类型 | 参数说明     | 备注 |
| ------- | -------- | ------------ | ---- |
| success | Boolean  | 是否成功     |      |
| count   | Int      | 用户总数     |      |
| items   | Array    | 用户数据集合 |      |

- 成功返回

```
状态码:200
响应体:
{
    'success': true,
    'count': 3,
    'items': [
        {'name': 'admin1', 'password': '123456'},
        {'name': 'admin2', 'password': '123456'},
        {'name': 'admin3', 'password': '123456'}
    ]
}
```

#### 2.7. 清空用户数据

- 请求路径:/api/reset-all
- 请求方法:get
- 响应参数

| 参数名  | 参数类型 | 参数说明 | 备注 |
| ------- | -------- | -------- | ---- |
| success | Boolean  | 是否成功 |      |

- 成功返回

```
状态码:200
响应体:
{
    'success': true
}
```

## 三、自动化发布:一键打 Tag 并上传至 PYPI

每次在 ** about **.py 更新版本号后,运行以下命令,实现自动化更新打包上传至 [PYPI](https://pypi.org/) ,同时根据其版本号自动打 Tag 并推送到仓库:

```
python3 setup.py pypi
```

注意:上传前需提前在 twine 工具中配置自己的 Pypi 的账号信息!!!

### 四、CHANGELOG

```
v1.0.0
1、实现对用户账号进行增删改查功能的 API 服务,包含了接口的签名校验机制;
2、完善了 API 使用文档;
3、添加了自动化打包脚本;
```

## 五、致谢

**A-Api-Server** 工具的产生和打包,主要参考了开源项目 [HttpRunner](https://github.com/httprunner/httprunner),受益多多,感谢!

## LICENSE

```
MIT License

Copyright (c) 2019 Devin https://zhangchuzhao.site
Copyright (c) 2017 Toby Qin

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
```



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/zhuifengshen/a-api-server",
    "name": "A-Api-Server",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=2.7, <4",
    "maintainer_email": "",
    "keywords": "ApiServer,Api,MockServer,Api Test,\u63a5\u53e3\u6d4b\u8bd5,\u63a5\u53e3\u81ea\u52a8\u5316\u6d4b\u8bd5",
    "author": "devin",
    "author_email": "1324556701@qq.com",
    "download_url": "https://files.pythonhosted.org/packages/a2/b8/a9dd4d38800870975eb1ad94135dc8f85e31a73b70502638325214aa1461/A_Api_Server-1.1.7.tar.gz",
    "platform": null,
    "description": "# A Api Server\n\n## \u4e00\u3001\u6982\u8ff0\n\nA api server\uff0c\u662f\u4e00\u4e2a Resful \u98ce\u683c\u7684\u7b80\u6613 API \u670d\u52a1\uff0c\u63d0\u4f9b\u4e86\u5bf9\u7528\u6237\u8d26\u53f7\u8fdb\u884c\u589e\u5220\u6539\u67e5\uff08CRUD\uff09\u529f\u80fd\u7684\u63a5\u53e3\u670d\u52a1\uff0c\u5305\u542b\u4e86\u63a5\u53e3\u7684\u7b7e\u540d\u6821\u9a8c\u673a\u5236\uff0c\u65b9\u4fbf API \u81ea\u52a8\u5316\u6d4b\u8bd5\u5de5\u5177\u7684\u5f00\u53d1\u4e0e\u8c03\u8bd5\uff01\n\n#### 1. \u672c\u5730\u542f\u52a8\u670d\u52a1\n\n- \uff081\uff09\u547d\u4ee4\u884c\u542f\u52a8\n\n```\npip install A-Api-Server\na_api_server \u81ea\u5b9a\u4e49\u7aef\u53e3\u53f7\uff08\u9ed8\u8ba45000\uff09\n```\n\n- \uff082\uff09clone \u6e90\u7801\u542f\u52a8\n\n```\npip install gunicorn flask\ncd a_api_server\npython api_server.py \u81ea\u5b9a\u4e49\u7aef\u53e3\u53f7\uff08\u9ed8\u8ba45000\uff09\n```\n\n\uff08\u6ce8\u610f\uff1a\u517c\u5bb9 Python2 \u548c Python3\uff09\n\n### 2. \u670d\u52a1\u7aef\u542f\u52a8\u670d\u52a1\uff0c\u63a8\u8350\u4f7f\u7528 gunicorn\n\n```\ncd a_api_server\ngunicorn api_server:app -p api_server.pid -b 0.0.0.0:5000 -w 4 -D\n\n\u670d\u52a1\u7aef\u5173\u95ed\u670d\u52a1\u7684\u547d\u4ee4\u5982\u4e0b\uff1a\nkill -HUP `cat api_server.pid`\nkill `cat api_server.pid`\n```\n\n### 3. \u542f\u52a8\u540e\u8bbf\u95ee\u5730\u5740\n\n```\nhttp://your.ip:5000\n```\n\n## \u4e8c\u3001\u63a5\u53e3\u6587\u6863\n\n### 1. API V1 \u63a5\u53e3\u8bf4\u660e\n\n- \u63a5\u53e3\u57fa\u51c6\u5730\u5740\uff1ahttp://your.ip:5000/\n- \u4f7f\u7528 HTTP Status Code \u6807\u8bc6\u72b6\u6001\n- \u6570\u636e\u8fd4\u56de\u683c\u5f0f\u7edf\u4e00\u4f7f\u7528 JSON\n- API V1 \u8ba4\u8bc1\u7edf\u4e00\u4f7f\u7528 Token \u8ba4\u8bc1\n- \u9700\u8981\u6388\u6743\u7684 API \uff0c\u5fc5\u987b\u5728\u8bf7\u6c42\u5934\u4e2d\u4f7f\u7528`device_sn`\u5b57\u6bb5\u63d0\u4f9b\u8bbe\u5907\u5e8f\u5217\u53f7\u548c `token` \u5b57\u6bb5\u63d0\u4f9b\u8bbf\u95ee\u4ee4\u724c\n- \u5168\u5c40\u8bf7\u6c42\u5934\n\n| \u53c2\u6570\u540d       | \u53c2\u6570\u7c7b\u578b | \u53c2\u6570\u8bf4\u660e   | \u5907\u6ce8                        |\n| ------------ | -------- | ---------- | --------------------------- |\n| Content-Type | String   | \u5185\u5bb9\u7c7b\u578b   | application/json            |\n| device_sn    | String   | \u8bbe\u5907\u5e8f\u5217\u53f7 | \u552f\u4e00\u8bbe\u5907\u6807\u8bc6\u7b26              |\n| token        | String   | \u8bbf\u95ee\u4ee4\u724c   | \u62e5\u6709 token \u7684\u8bbe\u5907\u624d\u6709\u8bbf\u95ee\u6743 |\n\n#### 1.1. \u652f\u6301\u7684\u8bf7\u6c42\u65b9\u6cd5\n\n- GET\uff08SELECT\uff09\uff1a\u4ece\u670d\u52a1\u5668\u53d6\u51fa\u8d44\u6e90\uff08\u4e00\u9879\u6216\u591a\u9879\uff09\u3002\n- POST\uff08CREATE\uff09\uff1a\u5728\u670d\u52a1\u5668\u65b0\u5efa\u4e00\u4e2a\u8d44\u6e90\u3002\n- PUT\uff08UPDATE\uff09\uff1a\u5728\u670d\u52a1\u5668\u66f4\u65b0\u8d44\u6e90\uff08\u5ba2\u6237\u7aef\u63d0\u4f9b\u6539\u53d8\u540e\u7684\u5b8c\u6574\u8d44\u6e90\uff09\u3002\n- PATCH\uff08UPDATE\uff09\uff1a\u5728\u670d\u52a1\u5668\u66f4\u65b0\u8d44\u6e90\uff08\u5ba2\u6237\u7aef\u63d0\u4f9b\u6539\u53d8\u7684\u5c5e\u6027\uff09\u3002\n- DELETE\uff08DELETE\uff09\uff1a\u4ece\u670d\u52a1\u5668\u5220\u9664\u8d44\u6e90\u3002\n- HEAD\uff1a\u83b7\u53d6\u8d44\u6e90\u7684\u5143\u6570\u636e\u3002\n- OPTIONS\uff1a\u83b7\u53d6\u4fe1\u606f\uff0c\u5173\u4e8e\u8d44\u6e90\u7684\u54ea\u4e9b\u5c5e\u6027\u662f\u5ba2\u6237\u7aef\u53ef\u4ee5\u6539\u53d8\u7684\u3002\n\n#### 1.2. \u901a\u7528\u8fd4\u56de\u72b6\u6001\u8bf4\u660e\n\n| _\u72b6\u6001\u7801_ | _\u542b\u4e49_                | _\u8bf4\u660e_                                              |\n| -------- | --------------------- | --------------------------------------------------- |\n| 200      | OK                    | \u8bf7\u6c42\u6210\u529f                                            |\n| 201      | CREATED               | \u521b\u5efa\u6210\u529f                                            |\n| 204      | DELETED               | \u5220\u9664\u6210\u529f                                            |\n| 400      | BAD REQUEST           | \u8bf7\u6c42\u7684\u5730\u5740\u4e0d\u5b58\u5728\u6216\u8005\u5305\u542b\u4e0d\u652f\u6301\u7684\u53c2\u6570                |\n| 401      | UNAUTHORIZED          | \u672a\u6388\u6743                                              |\n| 403      | FORBIDDEN             | \u88ab\u7981\u6b62\u8bbf\u95ee                                          |\n| 404      | NOT FOUND             | \u8bf7\u6c42\u7684\u8d44\u6e90\u4e0d\u5b58\u5728                                    |\n| 422      | Unprocesable entity   | [POST/PUT/PATCH] \u5f53\u521b\u5efa\u4e00\u4e2a\u5bf9\u8c61\u65f6\uff0c\u53d1\u751f\u4e00\u4e2a\u9a8c\u8bc1\u9519\u8bef |\n| 500      | INTERNAL SERVER ERROR | \u5185\u90e8\u9519\u8bef                                            |\n\n---\n\n### 2. \u5177\u4f53\u63a5\u53e3\u8bf4\u660e\n\n#### 2.1. \u83b7\u53d6\u4ee4\u724c\n\n- \u8bf7\u6c42\u8def\u5f84\uff1a/api/get-token\n- \u8bf7\u6c42\u65b9\u6cd5\uff1apost\n- \u8bf7\u6c42\u5934\n\n| \u53c2\u6570\u540d      | \u53c2\u6570\u7c7b\u578b | \u53c2\u6570\u8bf4\u660e   | \u5907\u6ce8 |\n| ----------- | -------- | ---------- | ---- |\n| User-Agent  | String   | \u7528\u6237\u4ee3\u7406   |      |\n| device_sn   | String   | \u8bbe\u5907\u5e8f\u5217\u53f7 |      |\n| os_platform | String   | \u7cfb\u7edf\u5e73\u53f0   |      |\n| app_version | String   | \u5e94\u7528\u7248\u672c   |      |\n\n- \u8bf7\u6c42\u53c2\u6570\n\n| \u53c2\u6570\u540d | \u53c2\u6570\u7c7b\u578b | \u53c2\u6570\u8bf4\u660e | \u5907\u6ce8                     |\n| ------ | -------- | -------- | ------------------------ |\n| sign   | String   | \u52a0\u5bc6\u7b7e\u540d | \u6839\u636e\u8bf7\u6c42\u5934\u548c\u5bc6\u94a5\u52a0\u5bc6\u751f\u6210 |\n\n- \u54cd\u5e94\u53c2\u6570\n\n| \u53c2\u6570\u540d  | \u53c2\u6570\u7c7b\u578b | \u53c2\u6570\u8bf4\u660e | \u5907\u6ce8       |\n| ------- | -------- | -------- | ---------- |\n| success | Boolean  | \u662f\u5426\u6210\u529f |            |\n| token   | String   | \u8bbf\u95ee\u4ee4\u724c | \u957f\u5ea6 16 \u4f4d |\n\n- \u6210\u529f\u8fd4\u56de\n\n```\n\u72b6\u6001\u7801\uff1a200\n\u54cd\u5e94\u4f53\uff1a\n{\n    'success': true,\n    'token': \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1aW\"\n}\n```\n\n- \u5931\u8d25\u8fd4\u56de\n\n```\n\u72b6\u6001\u7801\uff1a403\n\u54cd\u5e94\u4f53\uff1a\n{\n    'success': false,\n    'msg': \"Authorization failed!\"\n}\n```\n\n- \u7b7e\u540d\u751f\u6210\u7b97\u6cd5\n\n```python\ndef get_sign(*args):\n    SECRECT_KEY = 'YouMi'\n\tcontent = ''.join(args).encode('ascii')\n\tsign_key = SECRECT_KEY.encode('ascii')\n\tsign = hmac.new(sign_key, content, hashlib.sha1).hexdigest()\n\treturn sign\n\nsign = get_sign(user_agent, device_sn, os_platform, app_version)\n\n```\n\n#### 2.2. \u65b0\u5efa\u7528\u6237\n\n- \u8bf7\u6c42\u8def\u5f84\uff1a/api/users/:id\n- \u8bf7\u6c42\u65b9\u6cd5\uff1apost\n- \u8bf7\u6c42\u53c2\u6570\n\n| \u53c2\u6570\u540d   | \u53c2\u6570\u7c7b\u578b | \u53c2\u6570\u8bf4\u660e | \u5907\u6ce8 |\n| -------- | -------- | -------- | ---- |\n| id       | Int      | \u7528\u6237 ID  |      |\n| name     | String   | \u7528\u6237\u540d   |      |\n| password | String   | \u5bc6\u7801     |      |\n\n- \u54cd\u5e94\u53c2\u6570\n\n| \u53c2\u6570\u540d  | \u53c2\u6570\u7c7b\u578b | \u53c2\u6570\u8bf4\u660e | \u5907\u6ce8 |\n| ------- | -------- | -------- | ---- |\n| success | Boolean  | \u662f\u5426\u6210\u529f |      |\n| msg     | String   | \u8bf4\u660e\u4fe1\u606f |      |\n\n- \u6210\u529f\u8fd4\u56de\n\n```\n\u72b6\u6001\u7801\uff1a201\n\u54cd\u5e94\u4f53\uff1a\n{\n    'success': true,\n    'msg': \"user created successfully.\"\n}\n```\n\n- \u5931\u8d25\u8fd4\u56de\n\n```\n\u72b6\u6001\u7801\uff1a422\n\u54cd\u5e94\u4f53\uff1a\n{\n    'success': false,\n    'msg': \"user already existed.\"\n}\n```\n\n#### 2.3. \u6839\u636e ID \u67e5\u8be2\u7528\u6237\u4fe1\u606f\n\n- \u8bf7\u6c42\u8def\u5f84\uff1a/api/users/:id\n- \u8bf7\u6c42\u65b9\u6cd5\uff1aget\n- \u54cd\u5e94\u53c2\u6570\n\n| \u53c2\u6570\u540d   | \u53c2\u6570\u7c7b\u578b | \u53c2\u6570\u8bf4\u660e | \u5907\u6ce8 |\n| -------- | -------- | -------- | ---- |\n| success  | Boolean  | \u662f\u5426\u6210\u529f |      |\n| name     | String   | \u7528\u6237\u540d   |      |\n| password | String   | \u5bc6\u7801     |      |\n\n- \u6210\u529f\u8fd4\u56de\n\n```\n\u72b6\u6001\u7801\uff1a200\n\u54cd\u5e94\u4f53\uff1a\n{\n    'success': true,\n    'data': {\n        'name': 'admin',\n        'password': '123456'\n    }\n}\n```\n\n- \u5931\u8d25\u8fd4\u56de\n\n```\n\u72b6\u6001\u7801\uff1a404\n\u54cd\u5e94\u4f53\uff1a\n{\n    'success': fasle,\n    'data': {}\n}\n```\n\n#### 2.4. \u66f4\u65b0\u7528\u6237\u4fe1\u606f\n\n- \u8bf7\u6c42\u8def\u5f84\uff1a/api/users/:id\n- \u8bf7\u6c42\u65b9\u6cd5\uff1aput\n- \u8bf7\u6c42\u53c2\u6570\n\n| \u53c2\u6570\u540d   | \u53c2\u6570\u7c7b\u578b | \u53c2\u6570\u8bf4\u660e | \u5907\u6ce8 |\n| -------- | -------- | -------- | ---- |\n| id       | Int      | \u7528\u6237 ID  |      |\n| name     | String   | \u7528\u6237\u540d   |      |\n| password | String   | \u5bc6\u7801     |      |\n\n- \u54cd\u5e94\u53c2\u6570\n\n| \u53c2\u6570\u540d  | \u53c2\u6570\u7c7b\u578b | \u53c2\u6570\u8bf4\u660e | \u5907\u6ce8 |\n| ------- | -------- | -------- | ---- |\n| success | Boolean  | \u662f\u5426\u6210\u529f |      |\n| data    | Dict     | \u7528\u6237\u4fe1\u606f |      |\n\n- \u6210\u529f\u8fd4\u56de\n\n```\n\u72b6\u6001\u7801\uff1a200\n\u54cd\u5e94\u4f53\uff1a\n{\n    'success': true,\n    'data': {\n        'name': 'admin',\n        'password': '123456'\n    }\n}\n```\n\n- \u5931\u8d25\u8fd4\u56de\n\n```\n\u72b6\u6001\u7801\uff1a404\n\u54cd\u5e94\u4f53\uff1a\n{\n    'success': fasle,\n    'data': {}\n}\n```\n\n#### 2.5. \u5220\u9664\u7528\u6237\u4fe1\u606f\n\n- \u8bf7\u6c42\u8def\u5f84\uff1a/api/users/:id\n- \u8bf7\u6c42\u65b9\u6cd5\uff1adelete\n- \u8bf7\u6c42\u53c2\u6570\n\n| \u53c2\u6570\u540d | \u53c2\u6570\u7c7b\u578b | \u53c2\u6570\u8bf4\u660e | \u5907\u6ce8 |\n| ------ | -------- | -------- | ---- |\n| id     | Int      | \u7528\u6237 ID  |      |\n\n- \u54cd\u5e94\u53c2\u6570\n\n| \u53c2\u6570\u540d  | \u53c2\u6570\u7c7b\u578b | \u53c2\u6570\u8bf4\u660e | \u5907\u6ce8 |\n| ------- | -------- | -------- | ---- |\n| success | Boolean  | \u662f\u5426\u6210\u529f |      |\n| data    | Dict     | \u7528\u6237\u4fe1\u606f |      |\n\n- \u6210\u529f\u8fd4\u56de\n\n```\n\u72b6\u6001\u7801\uff1a200\n\u54cd\u5e94\u4f53\uff1a\n{\n    'success': true,\n    'data': {\n        'name': 'admin',\n        'password': '123456'\n    }\n}\n```\n\n- \u5931\u8d25\u8fd4\u56de\n\n```\n\u72b6\u6001\u7801\uff1a404\n\u54cd\u5e94\u4f53\uff1a\n{\n    'success': fasle,\n    'data': {}\n}\n```\n\n#### 2.6. \u7528\u6237\u6570\u636e\u5217\u8868\n\n- \u8bf7\u6c42\u8def\u5f84\uff1a/api/users\n- \u8bf7\u6c42\u65b9\u6cd5\uff1aget\n- \u54cd\u5e94\u53c2\u6570\n\n| \u53c2\u6570\u540d  | \u53c2\u6570\u7c7b\u578b | \u53c2\u6570\u8bf4\u660e     | \u5907\u6ce8 |\n| ------- | -------- | ------------ | ---- |\n| success | Boolean  | \u662f\u5426\u6210\u529f     |      |\n| count   | Int      | \u7528\u6237\u603b\u6570     |      |\n| items   | Array    | \u7528\u6237\u6570\u636e\u96c6\u5408 |      |\n\n- \u6210\u529f\u8fd4\u56de\n\n```\n\u72b6\u6001\u7801\uff1a200\n\u54cd\u5e94\u4f53\uff1a\n{\n    'success': true,\n    'count': 3,\n    'items': [\n        {'name': 'admin1', 'password': '123456'},\n        {'name': 'admin2', 'password': '123456'},\n        {'name': 'admin3', 'password': '123456'}\n    ]\n}\n```\n\n#### 2.7. \u6e05\u7a7a\u7528\u6237\u6570\u636e\n\n- \u8bf7\u6c42\u8def\u5f84\uff1a/api/reset-all\n- \u8bf7\u6c42\u65b9\u6cd5\uff1aget\n- \u54cd\u5e94\u53c2\u6570\n\n| \u53c2\u6570\u540d  | \u53c2\u6570\u7c7b\u578b | \u53c2\u6570\u8bf4\u660e | \u5907\u6ce8 |\n| ------- | -------- | -------- | ---- |\n| success | Boolean  | \u662f\u5426\u6210\u529f |      |\n\n- \u6210\u529f\u8fd4\u56de\n\n```\n\u72b6\u6001\u7801\uff1a200\n\u54cd\u5e94\u4f53\uff1a\n{\n    'success': true\n}\n```\n\n## \u4e09\u3001\u81ea\u52a8\u5316\u53d1\u5e03\uff1a\u4e00\u952e\u6253 Tag \u5e76\u4e0a\u4f20\u81f3 PYPI\n\n\u6bcf\u6b21\u5728 ** about **.py \u66f4\u65b0\u7248\u672c\u53f7\u540e\uff0c\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff0c\u5b9e\u73b0\u81ea\u52a8\u5316\u66f4\u65b0\u6253\u5305\u4e0a\u4f20\u81f3 [PYPI](https://pypi.org/) \uff0c\u540c\u65f6\u6839\u636e\u5176\u7248\u672c\u53f7\u81ea\u52a8\u6253 Tag \u5e76\u63a8\u9001\u5230\u4ed3\u5e93\uff1a\n\n```\npython3 setup.py pypi\n```\n\n\u6ce8\u610f\uff1a\u4e0a\u4f20\u524d\u9700\u63d0\u524d\u5728 twine \u5de5\u5177\u4e2d\u914d\u7f6e\u81ea\u5df1\u7684 Pypi \u7684\u8d26\u53f7\u4fe1\u606f\uff01\uff01\uff01\n\n### \u56db\u3001CHANGELOG\n\n```\nv1.0.0\n1\u3001\u5b9e\u73b0\u5bf9\u7528\u6237\u8d26\u53f7\u8fdb\u884c\u589e\u5220\u6539\u67e5\u529f\u80fd\u7684 API \u670d\u52a1\uff0c\u5305\u542b\u4e86\u63a5\u53e3\u7684\u7b7e\u540d\u6821\u9a8c\u673a\u5236\uff1b\n2\u3001\u5b8c\u5584\u4e86 API \u4f7f\u7528\u6587\u6863\uff1b\n3\u3001\u6dfb\u52a0\u4e86\u81ea\u52a8\u5316\u6253\u5305\u811a\u672c\uff1b\n```\n\n## \u4e94\u3001\u81f4\u8c22\n\n**A-Api-Server** \u5de5\u5177\u7684\u4ea7\u751f\u548c\u6253\u5305\uff0c\u4e3b\u8981\u53c2\u8003\u4e86\u5f00\u6e90\u9879\u76ee [HttpRunner](https://github.com/httprunner/httprunner)\uff0c\u53d7\u76ca\u591a\u591a\uff0c\u611f\u8c22\uff01\n\n## LICENSE\n\n```\nMIT License\n\nCopyright (c) 2019 Devin https://zhangchuzhao.site\nCopyright (c) 2017 Toby Qin\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n```\n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "\u81ea\u5efa\u4e00\u4e2aResful\u98ce\u683c\u7684\u63a5\u53e3\u81ea\u52a9\u670d\u52a1\uff0c\u65b9\u4fbfAPI\u81ea\u52a8\u5316\u6d4b\u8bd5\u5de5\u5177\u7684\u5f00\u53d1\u4e0e\u8c03\u8bd5\uff01",
    "version": "1.1.7",
    "project_urls": {
        "Homepage": "https://github.com/zhuifengshen/a-api-server"
    },
    "split_keywords": [
        "apiserver",
        "api",
        "mockserver",
        "api test",
        "\u63a5\u53e3\u6d4b\u8bd5",
        "\u63a5\u53e3\u81ea\u52a8\u5316\u6d4b\u8bd5"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "78d1ab1fb421c0df5937286a69096762def9dabcea1e9565d4abc34a2d107190",
                "md5": "119bce52fa39dc0d457278fd175fd0f4",
                "sha256": "84c01b2e6bf43cf2d912ff609cf3fa9dbdb378a8432f9df8b9da626895c52985"
            },
            "downloads": -1,
            "filename": "A_Api_Server-1.1.7-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "119bce52fa39dc0d457278fd175fd0f4",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": ">=2.7, <4",
            "size": 7886,
            "upload_time": "2023-08-04T07:18:05",
            "upload_time_iso_8601": "2023-08-04T07:18:05.938844Z",
            "url": "https://files.pythonhosted.org/packages/78/d1/ab1fb421c0df5937286a69096762def9dabcea1e9565d4abc34a2d107190/A_Api_Server-1.1.7-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a2b8a9dd4d38800870975eb1ad94135dc8f85e31a73b70502638325214aa1461",
                "md5": "361e4429c78c8c071a39608b8513aa65",
                "sha256": "ebb4f030d7aed1b737b31209165f20374c59318a955724e36e068beb47ca1edf"
            },
            "downloads": -1,
            "filename": "A_Api_Server-1.1.7.tar.gz",
            "has_sig": false,
            "md5_digest": "361e4429c78c8c071a39608b8513aa65",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=2.7, <4",
            "size": 8205,
            "upload_time": "2023-08-04T07:18:10",
            "upload_time_iso_8601": "2023-08-04T07:18:10.783864Z",
            "url": "https://files.pythonhosted.org/packages/a2/b8/a9dd4d38800870975eb1ad94135dc8f85e31a73b70502638325214aa1461/A_Api_Server-1.1.7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-08-04 07:18:10",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "zhuifengshen",
    "github_project": "a-api-server",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "a-api-server"
}
        
Elapsed time: 0.13459s