Major Changes: - ✅ Restored: TENCENT_SECRET_ID/TENCENT_SECRET_KEY authentication - ✅ Fixed: TC3-HMAC-SHA256 signature implementation - ✅ Fixed: SERVICE='dnspod' in credential scope (not API_VERSION) - ✅ Fixed: API parameter naming (SubDomain not Subdomain) - ✅ Fixed: Error handling for empty record lists Files Updated: - scripts/deploy_record.py - Complete rewrite with correct signing - .env.example - Updated to Tencent Cloud credentials format - SKILL.md - Updated documentation for API 3.0 New Documentation: - MIGRATION.md - Migration guide - UPDATE-SUMMARY-V3.md - Version 3.0 update summary - TEST-REPORT.md - Test results and verification Testing Results: ✅ API connection successful ✅ Domain query working ✅ Record creation successful (tested: test.eoxnet.com A 1.2.3.4) ✅ Record verification working ✅ Error handling complete API Details: - Endpoint: dnspod.tencentcloudapi.com - Version: 2021-03-23 - Signature: TC3-HMAC-SHA256 - Service: dnspod Version: 3.0 (Tencent Cloud API 3.0)
腾讯云DNSPod域名快速部署 Skill
这是一个用于快速部署和自动化管理腾讯云DNSPod域名解析的OpenClaw Skill。
功能特性
✅ 单条记录快速部署 - 添加/更新A、CNAME、MX等记录 ✅ 批量部署 - 从JSON配置文件批量创建记录 ✅ 服务快速部署 - 一键部署Web、API、CDN等服务 ✅ 记录查询 - 查看域名下的所有解析记录 ✅ 记录删除 - 删除不需要的DNS记录 ✅ 自动域名创建 - 部署时自动创建不存在的域名
安装
1. 安装依赖
cd tencent-dnspod
pip install -r requirements.txt
2. 配置认证密钥
访问腾讯云控制台获取API密钥: https://console.cloud.tencent.com/cam/capi
有两种配置方式:
方式1: 使用 .env 文件(推荐)
cp .env.example .env
# 编辑 .env 文件,填入你的密钥
方式2: 设置环境变量
export TENCENT_SECRET_ID="你的SecretId"
export TENCENT_SECRET_KEY="你的SecretKey"
3. 验证安装
python scripts/list_records.py --domain example.com
快速使用
场景1: 部署Web服务
一键部署主域名和www子域名:
python scripts/deploy_service.py \
--domain example.com \
--service web \
--ip 1.2.3.4
带泛域名解析:
python scripts/deploy_service.py \
--domain example.com \
--service web \
--ip 1.2.3.4 \
--wildcard
场景2: 部署API服务
python scripts/deploy_service.py \
--domain example.com \
--service api \
--ip 1.2.3.5 \
--subdomain api
场景3: 批量部署
从配置文件批量部署:
python scripts/batch_deploy.py \
--domain example.com \
--config examples/dns-config.json
场景4: 单条记录管理
添加A记录:
python scripts/deploy_record.py \
--domain example.com \
--subdomain www \
--type A \
--value 1.2.3.4
添加CNAME记录(CDN):
python scripts/deploy_record.py \
--domain example.com \
--subdomain cdn \
--type CNAME \
--value cdn.example.com.cdn.dnsv1.com
强制更新现有记录:
python scripts/deploy_record.py \
--domain example.com \
--subdomain www \
--type A \
--value 1.2.3.5 \
--force
场景5: 查询和删除
查询所有记录:
python scripts/list_records.py --domain example.com
删除记录:
python scripts/delete_record.py \
--domain example.com \
--subdomain www \
--type A
目录结构
tencent-dnspod/
├── SKILL.md # Skill说明文档
├── README.md # 本文件
├── requirements.txt # Python依赖
├── scripts/ # 脚本目录
│ ├── deploy_record.py # 单条记录部署
│ ├── batch_deploy.py # 批量部署
│ ├── deploy_service.py # 服务快速部署
│ ├── list_records.py # 记录查询
│ └── delete_record.py # 记录删除
├── references/ # 参考文档
│ ├── api-auth.md # API认证说明
│ └── common-errors.md # 常见错误处理
└── examples/ # 示例配置
└── dns-config.json # 批量部署配置示例
配置文件格式
批量部署配置文件(JSON格式):
{
"records": [
{
"subdomain": "@",
"type": "A",
"value": "1.2.3.4",
"line": "默认",
"ttl": 600,
"remark": "主域名"
},
{
"subdomain": "www",
"type": "A",
"value": "1.2.3.4",
"line": "默认",
"remark": "Web服务"
},
{
"subdomain": "api",
"type": "A",
"value": "1.2.3.5",
"line": "电信",
"remark": "API服务"
},
{
"subdomain": "cdn",
"type": "CNAME",
"value": "cdn.example.com.cdn.dnsv1.com",
"line": "默认",
"remark": "CDN加速"
}
]
}
支持的记录类型
| 类型 | 说明 | 示例值 |
|---|---|---|
| A | IPv4地址 | 1.2.3.4 |
| AAAA | IPv6地址 | 2001:db8::1 |
| CNAME | 别名 | cdn.example.com |
| MX | 邮件服务器 | mx.example.com |
| TXT | 文本记录 | "v=spf1 include:_spf.example.com ~all" |
| NS | 域名服务器 | ns1.example.com |
常用线路
默认- 默认线路电信- 电信用户联通- 联通用户移动- 移动用户境外- 海外用户搜索引擎- 爬虫线路
最佳实践
- 部署前测试 - 先在测试域名验证配置
- 设置合理TTL - 生产环境600s,测试环境60s
- 使用批量部署 - 多条记录用配置文件管理
- 添加记录备注 - 方便后续维护
- 分环境管理 - 使用不同子域名(dev/stage/prod)
- 注意API限频 - 批量操作时控制请求频率
常见问题
1. 认证失败
错误: AuthFailure
解决: 检查环境变量 TENCENT_SECRET_ID 和 TENCENT_SECRET_KEY
2. 域名不存在
错误: ResourceNotFound.Domain
解决: 使用 --create-domain 参数自动创建域名
3. 记录已存在
错误: RecordAlreadyExists
解决: 使用 --force 参数强制更新
4. API频率限制
错误: RequestLimitExceeded
解决: 批量操作时增加 --delay 参数(默认0.5秒)
详细错误处理见: references/common-errors.md
技术支持
- DNSPod API文档: https://cloud.tencent.com/document/product/1427/56152
- 腾讯云SDK: https://cloud.tencent.com/document/sdk
- DNSPod控制台: https://console.dnspod.cn
许可证
MIT License
贡献
欢迎提交Issue和Pull Request!
Description
Languages
Python
100%