Skip to content

Instantly share code, notes, and snippets.

@SebJansen
Created April 13, 2022 01:46
Show Gist options
  • Save SebJansen/f84060bd0d9d557c98c6176355e02c4f to your computer and use it in GitHub Desktop.
Save SebJansen/f84060bd0d9d557c98c6176355e02c4f to your computer and use it in GitHub Desktop.
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