When I was investigating how to use the module called dnspython, I used a for statement to display the response as shown below, and I had a simple question, so I made a note.
The conclusion of the title is the theory that "I wish I could return from either", which behaves in the same way as when setting a general primary DNS or secondary DNS, and even if it does not return from all, several times. It seems that he will inquire. However, if the code SERVFAIL is returned, it seems that it will be excluded from the retry target.
The reason for the experiment below
Part for dig with python
resolver = dns.resolver.Resolver()
resolver.nameservers = [socket.gethostbyname(nameserver)]
for rdata in resolver.query('www.yahoo.com', 'A'):
print rdata
I thought this short-circuited.
However, if you think calmly
I didn't know which one it was, so I tried it & read the source, but it works
It was a very reasonable result as the behavior of DNS. (Well, if you think about it now, default is the default DNS setting)
The following digression. The reason why I had the above desire was that I had to check if the zone was really set for all the DNS servers of Route53 that set a specific zone, and I didn't want to put a for statement. ..
Recommended Posts