dns :: resolver :: Resolver :: Class Resolver |
[hide private]
[frames] | no frames]

# Class Resolver

source code

    object --+
             |
            Resolver

DNS stub resolver

Instance Methods | [hide private]
__init__(self, filename=`'``/etc/resolv.conf``'`, configure=True) Initialize a resolver instance. | source code
reset(self) Reset all resolver configuration to the defaults. | source code
read_resolv_conf(self, f) Process f as a file in the /etc/resolv.conf format. | source code
_determine_split_char(self, entry) | source code
_config_win32_nameservers(self, nameservers) Configure a NameServer registry entry. | source code
_config_win32_domain(self, domain) Configure a Domain registry entry. | source code
_config_win32_search(self, search) Configure a Search registry entry. | source code
_config_win32_fromkey(self, key) Extract DNS info from a registry key. | source code
read_registry(self) Extract resolver configuration from the Windows registry. | source code
_win32_is_nic_enabled(self, lm, guid, interface_key) | source code
_compute_timeout(self, start) | source code
dns.resolver.Answer instance |
query(self, qname, rdtype=1, rdclass=1, tcp=False, source=None, raise_on_no_answer=True) Query nameservers to find the answer to the question. | source code
use_tsig(self, keyring, keyname=None, algorithm=<DNS name HMAC-MD5.SIG-ALG.REG.INT.>) Add a TSIG signature to the query. | source code
use_edns(self, edns, ednsflags, payload) Configure Edns. | source code
Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__sizeof__`, `__str__`, `__subclasshook__`

Instance Variables | [hide private]
dns.resolver.Cache object | cache The cache to use.
dns.name.Name object | domain The domain of this host
int | edns The EDNS level to use.
int | ednsflags The EDNS flags
string | keyalgorithm The TSIG key algorithm to use.
dns.name.Name object | keyname The TSIG keyname to use.
dict | keyring The TSIG keyring to use.
float | lifetime The total number of seconds to spend trying to get an answer to the question.
list of strings | nameservers A list of nameservers to query.
int | payload The EDNS payload size.
int | port The port to which to send queries.
list of dns.name.Name objects | search The search list.
float | timeout The number of seconds to wait for a response from a server, before timing out.

Properties | [hide private]
Inherited from `object`: `__class__`

Method Details | [hide private]

### __init__(self, filename=`'``/etc/resolv.conf``'`, configure=True) (Constructor) | source code
Initialize a resolver instance. Parameters: `filename` (string or file object) - The filename of a configuration file in standard /etc/resolv.conf format. This parameter is meaningful only when configure is true and the platform is POSIX. `configure` (bool) - If True (the default), the resolver instance is configured in the normal fashion for the operating system the resolver is running on. (I.e. a /etc/resolv.conf file on POSIX systems and from the registry on Windows systems.) Overrides: object.__init__

### read_resolv_conf(self, f) | source code
Process f as a file in the /etc/resolv.conf format. If f is a string, it is used as the name of the file to open; otherwise it is treated as the file itself.

### query(self, qname, rdtype=1, rdclass=1, tcp=False, source=None, raise_on_no_answer=True) | source code
Query nameservers to find the answer to the question. The qname, rdtype, and rdclass parameters may be objects of the appropriate type, or strings that can be converted into objects of the appropriate type. E.g. For rdtype the integer 2 and the the string 'NS' both mean to query for records with DNS rdata type NS. Parameters: `qname` (dns.name.Name object or string) - the query name `rdtype` (int or string) - the query type `rdclass` (int or string) - the query class `tcp` (bool) - use TCP to make the query (default is False). `source` (IP address in dotted quad notation) - bind to this IP address (defaults to machine default IP). `raise_on_no_answer` (bool) - raise NoAnswer if there's no answer (defaults is True). Returns: dns.resolver.Answer instance Raises: `Timeout` - no answers could be found in the specified lifetime `NXDOMAIN` - the query name does not exist `NoAnswer` - the response did not contain an answer and raise_on_no_answer is True. `NoNameservers` - no non-broken nameservers are available to answer the question.

### use_tsig(self, keyring, keyname=None, algorithm=<DNS name HMAC-MD5.SIG-ALG.REG.INT.>) | source code
Add a TSIG signature to the query. Parameters: `keyring` (dict) - The TSIG keyring to use; defaults to None. `keyname` - The name of the TSIG key to use; defaults to None. The key must be defined in the keyring. If a keyring is specified but a keyname is not, then the key used will be the first key in the keyring. Note that the order of keys in a dictionary is not defined, so applications should supply a keyname when a keyring is used, unless they know the keyring contains only one key. `algorithm` (string) - The TSIG key algorithm to use. The default is dns.tsig.default_algorithm.

### use_edns(self, edns, ednsflags, payload) | source code
Configure Edns. Parameters: `edns` (int) - The EDNS level to use. The default is -1, no Edns. `ednsflags` (int) - The EDNS flags `payload` (int) - The EDNS payload size. The default is 0.

Instance Variable Details | [hide private]

### cache The cache to use. The default is None. Type: dns.resolver.Cache object

### edns The EDNS level to use. The default is -1, no Edns. Type: int

### keyalgorithm The TSIG key algorithm to use. The default is dns.tsig.default_algorithm. Type: string

### keyname The TSIG keyname to use. The default is None. Type: dns.name.Name object

### keyring The TSIG keyring to use. The default is None. Type: dict

### lifetime The total number of seconds to spend trying to get an answer to the question. If the lifetime expires, a Timeout exception will occur. Type: float

### nameservers A list of nameservers to query. Each nameserver is a string which contains the IP address of a nameserver. Type: list of strings

### payload The EDNS payload size. The default is 0. Type: int

### port The port to which to send queries. The default is 53. Type: int

### search The search list. If the query name is a relative name, the resolver will construct an absolute query name by appending the search names one by one to the query name. Type: list of dns.name.Name objects