Urgent Fix

This commit is contained in:
Stephen Cochrane 2020-11-08 18:02:04 +02:00
parent 93ddaf10c9
commit 8aee8ca0fc
1 changed files with 9 additions and 6 deletions

15
dns.py
View File

@ -59,17 +59,20 @@ if ip == "":
# Construct the post data # Construct the post data
for domain in domains: for domain in domains:
post = [{}] post = [{}]
req_url = url + "v1/domains/" + domain + "/records/A/@"
post[0]["type"] = "A"
post[0]["name"] = "@"
post[0]["data"] = ip
post[0]["ttl"] = 600
r = requests.put(req_url, headers=header, json=post)
print("Refreshing <" + domain + "> ---> " + str(r))
for sub in domains[domain]: for sub in domains[domain]:
post[0]["type"] = sub["type"] post[0]["type"] = sub["type"]
post[0]["name"] = sub["name"] post[0]["name"] = sub["name"]
if sub["type"] != "MX": post[0]["data"] = ip
post[0]["data"] = ip
else:
post[0]["data"] = domain
post[0]["priority"] = 0
post[0]["ttl"] = 3600 post[0]["ttl"] = 3600
# Do the put # Do the put
req_url = url + "v1/domains/" + domain + "/records/" + sub["type"] + "/" + sub["name"] req_url = url + "v1/domains/" + domain + "/records/" + sub["type"] + "/" + sub["name"]
r = requests.put(req_url, headers=header, json=post) r = requests.put(req_url, headers=header, json=post)
print(r) print("Refreshing <" + sub["name"] + "." + domain + "> ---> " + str(r))