# Web测试项目
这是一个简单的Flask web测试项目,包含多种API测试功能。
## 功能特性
- 🏠 **主页界面**: 美观的web界面,包含各种测试功能
- 📡 **API测试**: GET和POST请求测试
- 🌐 **外部API测试**: 测试调用外部API服务
- ❤️ **健康检查**: 服务状态监控
- 🐳 **Docker支持**: 容器化部署
- 🔧 **错误处理**: 完善的错误处理机制
## 项目结构
```
testrepoflow/
├── app.py # Flask应用主文件
├── requirements.txt # Python依赖
├── Dockerfile # Docker配置
├── templates/ # HTML模板
│ └── index.html # 主页模板
└── README.md # 项目说明
```
## 本地运行
### 1. 安装依赖
```bash
pip install -r requirements.txt
```
### 2. 运行应用
```bash
python app.py
```
应用将在 http://localhost:5000 启动
### 3. 访问功能
- **主页**: http://localhost:5000
- **API测试**: http://localhost:5000/api/test
- **健康检查**: http://localhost:5000/health
- **外部API测试**: http://localhost:5000/api/external-test
## Docker运行
### 1. 构建镜像
```bash
docker build -t testrepoflow .
```
### 2. 运行容器
```bash
docker run -p 5000:5000 testrepoflow
```
## API端点
### GET /api/test
返回简单的JSON响应
### POST /api/test
接收JSON数据并返回确认响应
### GET /api/external-test
测试外部API调用(jsonplaceholder.typicode.com)
### GET /health
健康检查端点,返回服务状态
## 测试功能
访问主页后,你可以:
1. **测试GET API**: 发送GET请求到本地API
2. **测试POST API**: 发送POST请求到本地API
3. **测试外部API**: 调用外部测试API
4. **健康检查**: 检查服务运行状态
5. **自定义POST测试**: 发送自定义数据
所有测试结果会实时显示在页面上,包含完整的JSON响应数据。
## 开发说明
- Flask应用运行在调试模式
- 支持热重载
- 包含错误处理和日志记录
- 响应格式统一为JSON
## 扩展建议
你可以在此基础上添加:
- 数据库集成
- 用户认证
- 更多API端点
- 单元测试
- 日志系统
- 配置管理
Raw data
{
"_id": null,
"home_page": "https://github.com/BACH-AI-Tools/testrepoflow",
"name": "testrepoflow",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": null,
"author": "Your Name",
"author_email": "Your Name <your.email@example.com>",
"download_url": "https://files.pythonhosted.org/packages/42/39/55bfc158d10b6a94dd7b5b5ee2f11520c9dcb136f4eb6958c5da93df65bc/testrepoflow-1.0.0.tar.gz",
"platform": null,
"description": "# Web\u6d4b\u8bd5\u9879\u76ee\n\n\u8fd9\u662f\u4e00\u4e2a\u7b80\u5355\u7684Flask web\u6d4b\u8bd5\u9879\u76ee\uff0c\u5305\u542b\u591a\u79cdAPI\u6d4b\u8bd5\u529f\u80fd\u3002\n\n## \u529f\u80fd\u7279\u6027\n\n- \ud83c\udfe0 **\u4e3b\u9875\u754c\u9762**: \u7f8e\u89c2\u7684web\u754c\u9762\uff0c\u5305\u542b\u5404\u79cd\u6d4b\u8bd5\u529f\u80fd\n- \ud83d\udce1 **API\u6d4b\u8bd5**: GET\u548cPOST\u8bf7\u6c42\u6d4b\u8bd5\n- \ud83c\udf10 **\u5916\u90e8API\u6d4b\u8bd5**: \u6d4b\u8bd5\u8c03\u7528\u5916\u90e8API\u670d\u52a1\n- \u2764\ufe0f **\u5065\u5eb7\u68c0\u67e5**: \u670d\u52a1\u72b6\u6001\u76d1\u63a7\n- \ud83d\udc33 **Docker\u652f\u6301**: \u5bb9\u5668\u5316\u90e8\u7f72\n- \ud83d\udd27 **\u9519\u8bef\u5904\u7406**: \u5b8c\u5584\u7684\u9519\u8bef\u5904\u7406\u673a\u5236\n\n## \u9879\u76ee\u7ed3\u6784\n\n```\ntestrepoflow/\n\u251c\u2500\u2500 app.py # Flask\u5e94\u7528\u4e3b\u6587\u4ef6\n\u251c\u2500\u2500 requirements.txt # Python\u4f9d\u8d56\n\u251c\u2500\u2500 Dockerfile # Docker\u914d\u7f6e\n\u251c\u2500\u2500 templates/ # HTML\u6a21\u677f\n\u2502 \u2514\u2500\u2500 index.html # \u4e3b\u9875\u6a21\u677f\n\u2514\u2500\u2500 README.md # \u9879\u76ee\u8bf4\u660e\n```\n\n## \u672c\u5730\u8fd0\u884c\n\n### 1. \u5b89\u88c5\u4f9d\u8d56\n\n```bash\npip install -r requirements.txt\n```\n\n### 2. \u8fd0\u884c\u5e94\u7528\n\n```bash\npython app.py\n```\n\n\u5e94\u7528\u5c06\u5728 http://localhost:5000 \u542f\u52a8\n\n### 3. \u8bbf\u95ee\u529f\u80fd\n\n- **\u4e3b\u9875**: http://localhost:5000\n- **API\u6d4b\u8bd5**: http://localhost:5000/api/test\n- **\u5065\u5eb7\u68c0\u67e5**: http://localhost:5000/health\n- **\u5916\u90e8API\u6d4b\u8bd5**: http://localhost:5000/api/external-test\n\n## Docker\u8fd0\u884c\n\n### 1. \u6784\u5efa\u955c\u50cf\n\n```bash\ndocker build -t testrepoflow .\n```\n\n### 2. \u8fd0\u884c\u5bb9\u5668\n\n```bash\ndocker run -p 5000:5000 testrepoflow\n```\n\n## API\u7aef\u70b9\n\n### GET /api/test\n\u8fd4\u56de\u7b80\u5355\u7684JSON\u54cd\u5e94\n\n### POST /api/test\n\u63a5\u6536JSON\u6570\u636e\u5e76\u8fd4\u56de\u786e\u8ba4\u54cd\u5e94\n\n### GET /api/external-test\n\u6d4b\u8bd5\u5916\u90e8API\u8c03\u7528\uff08jsonplaceholder.typicode.com\uff09\n\n### GET /health\n\u5065\u5eb7\u68c0\u67e5\u7aef\u70b9\uff0c\u8fd4\u56de\u670d\u52a1\u72b6\u6001\n\n## \u6d4b\u8bd5\u529f\u80fd\n\n\u8bbf\u95ee\u4e3b\u9875\u540e\uff0c\u4f60\u53ef\u4ee5\uff1a\n\n1. **\u6d4b\u8bd5GET API**: \u53d1\u9001GET\u8bf7\u6c42\u5230\u672c\u5730API\n2. **\u6d4b\u8bd5POST API**: \u53d1\u9001POST\u8bf7\u6c42\u5230\u672c\u5730API\n3. **\u6d4b\u8bd5\u5916\u90e8API**: \u8c03\u7528\u5916\u90e8\u6d4b\u8bd5API\n4. **\u5065\u5eb7\u68c0\u67e5**: \u68c0\u67e5\u670d\u52a1\u8fd0\u884c\u72b6\u6001\n5. **\u81ea\u5b9a\u4e49POST\u6d4b\u8bd5**: \u53d1\u9001\u81ea\u5b9a\u4e49\u6570\u636e\n\n\u6240\u6709\u6d4b\u8bd5\u7ed3\u679c\u4f1a\u5b9e\u65f6\u663e\u793a\u5728\u9875\u9762\u4e0a\uff0c\u5305\u542b\u5b8c\u6574\u7684JSON\u54cd\u5e94\u6570\u636e\u3002\n\n## \u5f00\u53d1\u8bf4\u660e\n\n- Flask\u5e94\u7528\u8fd0\u884c\u5728\u8c03\u8bd5\u6a21\u5f0f\n- \u652f\u6301\u70ed\u91cd\u8f7d\n- \u5305\u542b\u9519\u8bef\u5904\u7406\u548c\u65e5\u5fd7\u8bb0\u5f55\n- \u54cd\u5e94\u683c\u5f0f\u7edf\u4e00\u4e3aJSON\n\n## \u6269\u5c55\u5efa\u8bae\n\n\u4f60\u53ef\u4ee5\u5728\u6b64\u57fa\u7840\u4e0a\u6dfb\u52a0\uff1a\n\n- \u6570\u636e\u5e93\u96c6\u6210\n- \u7528\u6237\u8ba4\u8bc1\n- \u66f4\u591aAPI\u7aef\u70b9\n- \u5355\u5143\u6d4b\u8bd5\n- \u65e5\u5fd7\u7cfb\u7edf\n- \u914d\u7f6e\u7ba1\u7406\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A short description",
"version": "1.0.0",
"project_urls": {
"Homepage": "https://github.com/BACH-AI-Tools/testrepoflow"
},
"split_keywords": [],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "e023de1477e3ee549e231e346737143a0224cbf2841604f58427e91a692a1a40",
"md5": "7e39a2efec4208b3817defe7a2676285",
"sha256": "38af10cda9842ea6008909ad46415f785299f824d63d2b7a36d56ec334d0ffb8"
},
"downloads": -1,
"filename": "testrepoflow-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "7e39a2efec4208b3817defe7a2676285",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 2363,
"upload_time": "2025-11-04T07:06:31",
"upload_time_iso_8601": "2025-11-04T07:06:31.035638Z",
"url": "https://files.pythonhosted.org/packages/e0/23/de1477e3ee549e231e346737143a0224cbf2841604f58427e91a692a1a40/testrepoflow-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "423955bfc158d10b6a94dd7b5b5ee2f11520c9dcb136f4eb6958c5da93df65bc",
"md5": "af86af0fb72b00487ec9ab96cf14d0ea",
"sha256": "377b0ad99fe17f97346c0a1f36960589c5dd19b57149d9a5724081bd7622631e"
},
"downloads": -1,
"filename": "testrepoflow-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "af86af0fb72b00487ec9ab96cf14d0ea",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 2644,
"upload_time": "2025-11-04T07:06:31",
"upload_time_iso_8601": "2025-11-04T07:06:31.922021Z",
"url": "https://files.pythonhosted.org/packages/42/39/55bfc158d10b6a94dd7b5b5ee2f11520c9dcb136f4eb6958c5da93df65bc/testrepoflow-1.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-11-04 07:06:31",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "BACH-AI-Tools",
"github_project": "testrepoflow",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "flask",
"specs": [
[
">=",
"2.3.0"
]
]
},
{
"name": "requests",
"specs": [
[
">=",
"2.31.0"
]
]
}
],
"lcname": "testrepoflow"
}