When I try to create dns.name a period is appended to the end.

69 views
Skip to first unread message

ByronFack

unread,
Aug 31, 2021, 3:43:51 AM8/31/21
to dnspython-users

I am running a resolve on a qname = dns.name.from_text(host_name, origin=None)  that is not fully qualified.  IE just the hostname.  However when I get the response all servers have refused the query becuase it ends in a .  if you don't specify origin=None it appends that period but I am specifying origin=None and it doesn't have when submitted but the output results show it is.  

host_name = 'surface'
qname = dns.name.from_text(host_name, origin=None)
print(qname.to_text())
surface
responses = dns.resolver.resolve(host_name, dns.rdatatype.A)
The DNS query name does not exist: surface.

Bob Halley

unread,
Aug 31, 2021, 7:58:36 AM8/31/21
to dnspython-users
Names are always absolute when sent in the DNS.  You are not requesting search in your call to resolve(), so the name gets converted to an absolute name.  If you want to apply a search list, pass search=True as a parameter to dns.resolver.resolve(). 
Reply all
Reply to author
Forward
0 new messages