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 thread-safe DNS answer cache.
  LRUCacheNode
LRUCache node.
  LRUCache
Thread-safe, 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
 
reset_default_resolver()
Re-initialize default resolver.
source code
 
query(qname, rdtype=1, rdclass=1, tcp=False, source=None, raise_on_no_answer=True, source_port=0, lifetime=None)
Query nameservers to find the answer to the question.
source code
 
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 prior override_system_resolver().
source code
Variables [hide private]
  default_resolver = None
hash(x)
  _protocols_for_socktype = {1: [6], 2: [17]}
  _resolver = None
hash(x)
  __package__ = 'dns'
Function Details [hide private]

reset_default_resolver()

source code 

Re-initialize default resolver.

Note that the resolver configuration (i.e. /etc/resolv.conf on UNIX systems) will be re-read immediately.

query(qname, rdtype=1, rdclass=1, tcp=False, source=None, raise_on_no_answer=True, source_port=0, lifetime=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 ``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.

*name*, an absolute ``dns.name.Name`` or ``text``, the query name.

*rdclass*, an ``int``, the query class.

*tcp*, a ``bool``. If ``True``, use TCP to make the query.

*resolver*, a ``dns.resolver.Resolver`` or ``None``, the resolver to use. If ``None``, the default resolver is used.

Raises ``dns.resolver.NoRootSOA`` if there is no SOA RR at the DNS root. (This is only likely to happen if you're using non-default root servers in your network and they are misconfigured.)

Returns a ``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.

resolver, a ``dns.resolver.Resolver`` or ``None``, the resolver to use.