Initial Pantheon infrastructure
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import os
|
||||
import requests
|
||||
from dotenv import load_dotenv
|
||||
|
||||
load_dotenv()
|
||||
|
||||
TOKEN = os.getenv("CF_API_TOKEN")
|
||||
ZONE = os.getenv("CF_ZONE_ID")
|
||||
|
||||
headers = {
|
||||
"Authorization": f"Bearer {TOKEN}",
|
||||
"Content-Type": "application/json",
|
||||
}
|
||||
|
||||
url = f"https://api.cloudflare.com/client/v4/zones/{ZONE}/dns_records"
|
||||
|
||||
response = requests.get(url, headers=headers)
|
||||
response.raise_for_status()
|
||||
|
||||
for record in response.json()["result"]:
|
||||
print(
|
||||
f"{record['type']:4} "
|
||||
f"{record['name']:35} "
|
||||
f"{record['content']}"
|
||||
)
|
||||
Reference in New Issue
Block a user