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 11:05:30 +01:00
committed by GitHub
parent 79100ac003
commit a19de553aa
@@ -142,7 +142,6 @@ class Cloudflare(BaseAccount):
return False return False
record_id = payload['result'][0]['id'] record_id = payload['result'][0]['id']
proxied = payload['result'][0]['proxied']
if self.is_verbose: if self.is_verbose:
syslog.syslog( syslog.syslog(
syslog.LOG_NOTICE, syslog.LOG_NOTICE,
@@ -156,11 +155,10 @@ class Cloudflare(BaseAccount):
'type': recordType, 'type': recordType,
'name': self.settings.get('hostnames'), 'name': self.settings.get('hostnames'),
'content': str(self.current_address), 'content': str(self.current_address),
'proxied': proxied
}, },
'headers': req_opts['headers'] 'headers': req_opts['headers']
} }
response = requests.put(**req_opts) response = requests.patch(**req_opts)
try: try:
payload = response.json() payload = response.json()
except requests.exceptions.JSONDecodeError: except requests.exceptions.JSONDecodeError: