update tokens
This commit is contained in:
@@ -15,17 +15,18 @@ print(ip.text)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
zoneId = "5f5b0bf2ebe816578be8c5553c98be6d"
|
zoneId = "b353396aee0b38123ecb538fa582e245"
|
||||||
apiToken = "fupBXzTMFsmgAxcna8ZTcmHnsX5dRznK2QtSSPl_"
|
apiToken = "7C8TjQjKPJLywGYI5172jE6BUeZgvidXCnMn6V8f"
|
||||||
apiKey = "58ec6020b9886fd8e30275b55ddc8b3c79bea"
|
#apiKey = "58ec6020b9886fd8e30275b55ddc8b3c79bea"
|
||||||
apiEmail = "christoph.califice@hotmail.com"
|
#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_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/"
|
url_updateEntry = f"https://api.cloudflare.com/client/v4/zones/{zoneId}/dns_records/"
|
||||||
reqHeaders = {
|
reqHeaders = {
|
||||||
#"Authorization": "Bearer " + apiToken,
|
"Authorization": "Bearer " + apiToken,
|
||||||
"X-Auth-Email": apiEmail,
|
#"X-Auth-Email": apiEmail,
|
||||||
"X-Auth-Key": apiKey
|
#"X-Auth-Key": apiKey
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -35,21 +36,21 @@ req = requests.get(url_getEntries, headers=reqHeaders)
|
|||||||
|
|
||||||
entriesJson = json.loads(req.text)
|
entriesJson = json.loads(req.text)
|
||||||
|
|
||||||
|
print(entriesJson)
|
||||||
|
|
||||||
|
|
||||||
for entry in entriesJson["result"]:
|
for entry in entriesJson["result"]:
|
||||||
if(entry["type"] == "A"):
|
if(entry["type"] == "A" and entry["name"] == "files.sereiaguardia.com"):
|
||||||
id = entry["id"]
|
id = entry["id"]
|
||||||
name = entry["name"]
|
name = entry["name"]
|
||||||
|
|
||||||
data = {
|
data = {
|
||||||
"content": f"{ip.text}",
|
"content": f"{ip.text}",
|
||||||
"name": f"{name}",
|
"name": f"{name}",
|
||||||
"ttl": "1"
|
"ttl": 1
|
||||||
}
|
}
|
||||||
|
|
||||||
print(data)
|
print(data)
|
||||||
|
|
||||||
resp = requests.patch(url_updateEntry + id, json=data, headers=reqHeaders)
|
resp = requests.patch(url_updateEntry + id, json=data, headers=reqHeaders)
|
||||||
print(resp.text)
|
print(resp.text)
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user