Cloudflare API 默认代理参数为 false



我使用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

这样做的正确方法是什么?

提前致谢

'proxied':'true'更改为'proxied': True,使其成为布尔值而不是字符串。

相关内容

最新更新