Behavior when multiple servers are specified in nameservers of dnspython

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

  1. ** nameservers behaves the same as when setting general primary DNS and secondary DNS **
  2. ** If there are multiple results of the inquiry target type, multiple results will be entered in rdata **

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

Behavior when multiple servers are specified in nameservers of dnspython
Behavior when Trainable = False of Container in Keras
Execution order when multiple context managers are specified in the Python with statement
Behavior in each language when coroutines are reused with for
Switch versions when multiple versions of java are included on Linux
Behavior when listing in Python heapq
The story when different distributions are specified for the same parameter in Optuna
Judgment of NaN in pandas: When str type and float type are mixed
How to write a string when there are multiple lines in python
When specifying multiple keys in python sort
Check the behavior of destructor in Python
Behavior when returning in the with block
Behavior change of [Diagram / Timeline] in Choregraphe 2.5.5.5
Behavior when SIGEV_THREAD is set in sigev_notify of sigevent with timer_create (C language)
Differences in the behavior of each LL language when the list index is skipped