Here is the code for the simple script:
import dns.resolver
domaininput = 'monash.edu'
resolver = dns.resolver.Resolver(configure=False)
resolver.nameservers = ['8.8.8.8']
answer = dns.resolver.query(domaininput, 'CAA')
for rdata in answer:
print(rdata)
This works and provides me with all three CAA records assigned to this domain. In this example (at the time of posting this), there should be 3 records:
0 issue "quovadisglobal.com"
0 issuewild "quovadisglobal.com"
0 iodef "mailto:[redacted]"
When I use this code in my Flask webapp (which is running in a virtual environment), the same exact code only provides me with one of these results at random. Here is the code from app.py in Flask:
--snip--
try:
resolver = dns.resolver.Resolver(configure=False)
resolver.nameservers = ['8.8.8.8']
answer = dns.resolver.query(domaininput, 'CAA', raise_on_no_answer=True)
for rdata in answer:
result = str(rdata)
except Exception as ex:
result = str(ex)
--snip--
Does anyone have an idea why this is happening? Even if I use rdata.to_text, I receive only one at random.