Created
April 13, 2022 01:46
-
-
Save SebJansen/f84060bd0d9d557c98c6176355e02c4f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import time | |
email = "hello@hello.com" | |
token = "qweqeqeqqweqeqeqweqwe" | |
zone = "qweqeqweqeqweqeqweqeqwe" | |
headers = { | |
"X-Auth-Email": email, | |
"X-Auth-Key": token, | |
"Content-Type": "application/json", | |
} | |
records = requests.get( | |
url=f"https://api.cloudflare.com/client/v4/zones/{zone}/dns_records", | |
headers=headers, | |
).json() | |
for record in records["result"]: | |
resp = requests.delete( | |
url=f'https://api.cloudflare.com/client/v4/zones/{zone}/dns_records/{record["id"]}', | |
headers=headers | |
).json() | |
if not resp['success']: | |
print(resp) | |
time.sleep(30) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment