From 9b1e485aec01406417f6dc95d4233cfc0b723fe7 Mon Sep 17 00:00:00 2001 From: Christoph Califice Date: Sun, 18 Jan 2026 16:56:14 -0300 Subject: [PATCH] update tokens --- updateCloudflateDNS.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/updateCloudflateDNS.py b/updateCloudflateDNS.py index c4fc619..e073146 100644 --- a/updateCloudflateDNS.py +++ b/updateCloudflateDNS.py @@ -15,17 +15,18 @@ print(ip.text) -zoneId = "5f5b0bf2ebe816578be8c5553c98be6d" -apiToken = "fupBXzTMFsmgAxcna8ZTcmHnsX5dRznK2QtSSPl_" -apiKey = "58ec6020b9886fd8e30275b55ddc8b3c79bea" -apiEmail = "christoph.califice@hotmail.com" +zoneId = "b353396aee0b38123ecb538fa582e245" +apiToken = "7C8TjQjKPJLywGYI5172jE6BUeZgvidXCnMn6V8f" +#apiKey = "58ec6020b9886fd8e30275b55ddc8b3c79bea" +#apiEmail = "christoph.califice@hotmail.com" +url_verify = f"https://api.cloudflare.com/client/v4/user/tokens/verify" url_getEntries = f"https://api.cloudflare.com/client/v4/zones/{zoneId}/dns_records" url_updateEntry = f"https://api.cloudflare.com/client/v4/zones/{zoneId}/dns_records/" reqHeaders = { - #"Authorization": "Bearer " + apiToken, - "X-Auth-Email": apiEmail, - "X-Auth-Key": apiKey + "Authorization": "Bearer " + apiToken, + #"X-Auth-Email": apiEmail, + #"X-Auth-Key": apiKey } @@ -35,21 +36,21 @@ req = requests.get(url_getEntries, headers=reqHeaders) entriesJson = json.loads(req.text) +print(entriesJson) + for entry in entriesJson["result"]: - if(entry["type"] == "A"): + if(entry["type"] == "A" and entry["name"] == "files.sereiaguardia.com"): id = entry["id"] name = entry["name"] data = { "content": f"{ip.text}", "name": f"{name}", - "ttl": "1" + "ttl": 1 } print(data) resp = requests.patch(url_updateEntry + id, json=data, headers=reqHeaders) print(resp.text) - - \ No newline at end of file