Package dns :: Module resolver
[hide private]
[frames] | no frames]

Module resolver

source code

DNS stub resolver.

Classes [hide private]
  NXDOMAIN
The query name does not exist.
  NoAnswer
The response did not contain an answer to the question.
  NoNameservers
No non-broken nameservers are available to answer the query.
  NotAbsolute
Raised if an absolute domain name is required but a relative name was provided.
  NoRootSOA
Raised if for some reason there is no SOA at the root name.
  Answer
DNS stub resolver answer
  Cache
Simple DNS answer cache.
  Resolver
DNS stub resolver
Functions [hide private]
 
get_default_resolver()
Get the default resolver, initializing it if necessary.
source code
 
query(qname, rdtype=dns.rdatatype.A, rdclass=dns.rdataclass.IN, tcp=False, source=None)
Query nameservers to find the answer to the question.
source code
dns.name.Name
zone_for_name(name, rdclass=dns.rdataclass.IN, tcp=False, resolver=None)
Find the name of the zone which contains the specified name.
source code
Variables [hide private]
  Timeout = dns.exception.Timeout
dns.resolver.Resolver object default_resolver = None
The default resolver object
Function Details [hide private]

query(qname, rdtype=dns.rdatatype.A, rdclass=dns.rdataclass.IN, tcp=False, source=None)

source code 

Query nameservers to find the answer to the question.

This is a convenience function that uses the default resolver object to make the query.

See Also: dns.resolver.Resolver.query for more information on the parameters.

zone_for_name(name, rdclass=dns.rdataclass.IN, tcp=False, resolver=None)

source code 

Find the name of the zone which contains the specified name.

Parameters:
  • name (absolute dns.name.Name object or string) - the query name
  • rdclass (int) - The query class
  • tcp (bool) - use TCP to make the query (default is False).
  • resolver (dns.resolver.Resolver object or None) - the resolver to use
Returns: dns.name.Name