This commit is contained in:
Lennart J. Kurzweg (Nx2)
2025-03-31 01:23:45 +02:00
parent d7d9b8e39c
commit 921f8fc6a7
4 changed files with 29 additions and 3 deletions

View File

@@ -49,11 +49,13 @@ let dns-user = "cloudflare"; in
} /* python */ ''
import requests
import subprocess
from time import sleep
def get_public_ip(ipv6: bool = False) -> str:
return subprocess.run(['${pkgs.curl}/bin/curl', '-s', '-6' if ipv6 else '-4', 'https://ifconfig.me'], capture_output=True, text=True).stdout.strip()
def update_record(record_id: str, record_name: str, ip: str, type: str, proxied: bool, pw: str) -> None:
sleep(5)
return requests.patch(
f'https://api.cloudflare.com/client/v4/zones/${zone_id}/dns_records/{record_id}',
headers={