Skip to content

Commit aa44899

Browse files
committed
Updated DNS python if result has CNAME
1 parent 536bdcb commit aa44899

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

dynamicdnsquery.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def querydnsserver(fqdn, ns):
1616
dnsdata = dns.message.make_query(fqdn, dns.rdatatype.A)
1717
try:
1818
query = dns.query.udp(dnsdata, ns, timeout=5)
19-
answer = query.answer[0].to_text()
19+
answer = query.answer[len(query.answer) - 1][0].to_text()
2020
return answer.split()[-1:][0]
2121
except Exception as e:
2222
logging.info(e)
@@ -43,7 +43,6 @@ def ddnsupdate():
4343
updaterequest = requests.get(apiurl, params=payload, timeout=10)
4444
if updaterequest.status_code == 200:
4545
logging.info('Send request to update IP address.')
46-
print('Request send to DDNS provider.')
4746
else:
4847
logging.info('Unable to update IP address.')
4948
except Exception as e:

0 commit comments

Comments
 (0)