pythonlinuxdnscloudflare

Cloudflare API defaults the proxied parameter to false


I use a Python script which allows me to auto-update the public IP of my Raspberry Pi on configured/selected Cloudflare DNS entries. This is done with the Cloudflare API.

It looks like the proxied parameter in the API is now defaulting to false, which is disabling the Cloudflare protection.

I have created a Cloudflare Support ticket and got the following answer:

Setting proxied = true in the api call will set the Cloudflare protection on when the record is updated.

Unfortunately, I can't program in Python (yet) so I am not able to fix this.

Original:

data=json.dumps({'type': record['type'], 'name': record['name'], 'content': ip_address}),

My attempt:

data=json.dumps({'type': record['type'], 'name': record['name'], 'content': ip_address, 'proxied':'true'}),

I get these error messages with my attempt at setting proxied to 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: []

Full python script:
GitHub view
Raw

What would be the correct way of doing this?


Solution

  • Change 'proxied':'true' to 'proxied': True to make it a bool instead of a string.