Api Integration
指导前端与后端API集成的类型、错误、鉴权及实时通信设计规范。
下载 255
CLI 工具用于构建、测试和保存 HTTP 请求,支持自定义头、认证、请求体和模板复用。
openclaw skills install @derick001/http-request-builder命令、参数、文件名以原文为准
一个命令行工具,用于构建、测试和保存 HTTP 请求。支持自定义请求头、认证方式、请求体和 Cookie。可将请求保存为模板以重复使用,并维护请求历史记录。
主要功能:
基础命令:
# 发送 GET 请求
python3 scripts/main.py get https://api.example.com/data
# 发送带 JSON 请求体的 POST 请求
python3 scripts/main.py post https://api.example.com/api \
--header "Content-Type: application/json" \
--body '{"name": "test", "value": 123}'
# 使用 Basic 认证发送请求
python3 scripts/main.py get https://api.example.com/secure \
--auth basic --username admin --password secret
# 使用 Bearer Token 发送请求
python3 scripts/main.py get https://api.example.com/secure \
--auth bearer --token "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9"
# 保存请求为模板
python3 scripts/main.py post https://api.example.com/api \
--header "Content-Type: application/json" \
--body '{"name": "test"}' \
--save-template my-request
# 加载并执行模板
python3 scripts/main.py template my-request
# 进入交互式模式
python3 scripts/main.py interactive
# 查看请求历史
python3 scripts/main.py history
# 清空历史记录
python3 scripts/main.py history --clearpython3 scripts/main.py get https://jsonplaceholder.typicode.com/posts/1输出:
Response Status: 200 OK
Response Headers:
content-type: application/json; charset=utf-8
...
Response Body:
{
"userId": 1,
"id": 1,
"title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit",
"body": "quia et suscipit\nsuscipit recusandae consequuntur expedita et cum\nreprehenderit molestiae ut ut quas totam\nnostrum rerum est autem sunt rem eveniet architecto"
}python3 scripts/main.py post https://jsonplaceholder.typicode.com/posts \
--header "Content-Type: application/json" \
--header "X-API-Key: my-secret-key" \
--body '{
"title": "foo",
"body": "bar",
"userId": 1
}'# 保存模板
python3 scripts/main.py post https://api.example.com/users \
--header "Content-Type: application/json" \
--header "Authorization: Bearer token123" \
--body '{"name": "New User"}' \
--save-template create-user
# 后续使用模板
python3 scripts/main.py template create-user
# 列出所有模板
python3 scripts/main.py templatespython3 scripts/main.py interactive交互式模式会引导你完成以下步骤:
requests 库(可自动安装,或通过 pip 安装)缺失依赖项的安装方式:
pip3 install requests~/.http-request-builder/ 目录下的简单 JSON 文件中工具数据存储于 ~/.http-request-builder/ 目录下:
templates/ - 已保存的请求模板(JSON 文件)history.json - 请求历史日志config.json - 配置文件(如有)本技能由 Skill Factory 开发。问题反馈和改进建议请通过 OpenClaw 项目提交。
已收录 2 个 Skill