ddclient: Cloudflare - update DNS record instead of overwriting (#3837)

Updating the record preserves proxied status, TTL, comment, and such.
This commit is contained in:
lin-xianming 2024-02-25 05:05:30 -05:00 committed by GitHub
parent 79100ac003
commit a19de553aa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -142,7 +142,6 @@ class Cloudflare(BaseAccount):
return False
record_id = payload['result'][0]['id']
proxied = payload['result'][0]['proxied']
if self.is_verbose:
syslog.syslog(
syslog.LOG_NOTICE,
@ -156,11 +155,10 @@ class Cloudflare(BaseAccount):
'type': recordType,
'name': self.settings.get('hostnames'),
'content': str(self.current_address),
'proxied': proxied
},
'headers': req_opts['headers']
}
response = requests.put(**req_opts)
response = requests.patch(**req_opts)
try:
payload = response.json()
except requests.exceptions.JSONDecodeError: