【发布时间】:2019-10-21 23:10:03
【问题描述】:
我使用了一个 python 脚本,它允许我在配置/选择的 Cloudflare DNS 条目上自动更新我的 Raspberry Pi 的公共 IP。这是通过 Cloudflare API 完成的。
看起来 API 中的代理参数现在默认为 false,这将禁用 Cloudflare 保护。
我已创建 Cloudflare 支持票证并得到以下答案:
在 api 调用中设置 proxied = true 将在记录更新时设置 Cloudflare 保护。
不幸的是,我还不能用 Python 编程,所以我无法解决这个问题。
原文:
data=json.dumps({'type': record['type'], 'name': record['name'], 'content': ip_address}),
我的尝试:
data=json.dumps({'type': record['type'], 'name': record['name'], 'content': ip_address, 'proxied':'true'}),
我尝试将代理设置为 true 时收到这些错误消息:
Updating the A record (ID 28b768cfd9760226648f3f22880bff7d) of (sub)domain www.******.com (ID 5129ccb06da9ae49f0a326ef945ff3e4) to **.**.***.**.
DNS record failed to update.
CloudFlare returned the following errors: [{u'error_chain': [{u'message': u"Invalid 'proxied' value, must be a boolean", u'code': 9003}], u'message': u'DNS Validation Error', u'code': 1004}].
CloudFlare returned the following messages: []
Updating the A record (ID f0269da1fab6dcad62c31755f98a6321) of (sub)domain ******.com (ID 5129ccb06da9ae49f0a326ef945ff3e4) to **.**.***.**.
DNS record failed to update.
CloudFlare returned the following errors: [{u'error_chain': [{u'message': u"Invalid 'proxied' value, must be a boolean", u'code': 9003}], u'message': u'DNS Validation Error', u'code': 1004}].
CloudFlare returned the following messages: []
完整的python脚本:
GitHub view
Raw
正确的做法是什么?
提前致谢
【问题讨论】:
标签: python linux api dns cloudflare