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

Module resolver

source code

DNS stub resolver.

Classes [hide private]
  NXDOMAIN
The DNS query name does not exist.
  YXDOMAIN
The DNS query name is too long after DNAME substitution.
  NoAnswer
The DNS response does not contain an answer to the question.
  NoNameservers
All nameservers failed to answer the query.
  NotAbsolute
An absolute domain name is required but a relative name was provided.
  NoRootSOA
There is no SOA RR at the DNS root name.
  NoMetaqueries
DNS metaqueries are not allowed.
  Answer
DNS stub resolver answer
  Cache
Simple DNS answer cache.
  LRUCacheNode
LRUCache node.
  LRUCache
Bounded least-recently-used 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=1, rdclass=1, tcp=False, source=None, raise_on_no_answer=True, source_port=0)
Query nameservers to find the answer to the question.
source code
dns.name.Name
zone_for_name(name, rdclass=1, tcp=False, resolver=None)
Find the name of the zone which contains the specified name.
source code
 
_getaddrinfo(host=None, service=None, family=0, socktype=0, proto=0, flags=0) source code
 
_getnameinfo(sockaddr, flags=0) source code
 
_getfqdn(name=None) source code
 
_gethostbyname(name) source code
 
_gethostbyname_ex(name) source code
 
_gethostbyaddr(ip) source code
 
override_system_resolver(resolver=None)
Override the system resolver routines in the socket module with versions which use dnspython's resolver.
source code
 
restore_system_resolver()
Undo the effects of override_system_resolver().
source code
Variables [hide private]
dns.resolver.Resolver object default_resolver = None
The default resolver object
  _protocols_for_socktype = {1: [6], 2: [17]}
  _resolver = None
hash(x)
  __package__ = 'dns'
Function Details [hide private]

query(qname, rdtype=1, rdclass=1, tcp=False, source=None, raise_on_no_answer=True, source_port=0)

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=1, 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

override_system_resolver(resolver=None)

source code 

Override the system resolver routines in the socket module with versions which use dnspython's resolver.

This can be useful in testing situations where you want to control the resolution behavior of python code without having to change the system's resolver settings (e.g. /etc/resolv.conf).

The resolver to use may be specified; if it's not, the default resolver will be used.

Parameters:
  • resolver (dns.resolver.Resolver object or None) - the resolver to use