Package dns :: Module query
[show private | hide private]
[frames | no frames]

Module dns.query

Talk to a DNS server.
Exceptions
BadResponse Raised if a query response does not respond to the question asked.
UnexpectedSource Raised if a query response comes from an unexpected address or port.

Function Summary
dns.message.Message object tcp(q, where, timeout, port, af, source, source_port)
Return the response obtained after sending a query via TCP.
dns.message.Message object udp(q, where, timeout, port, af, source, source_port)
Return the response obtained after sending a query via UDP.
generator of dns.message.Message objects. xfr(where, zone, rdtype, rdclass, timeout, port, keyring, keyname, relativize, af, lifetime, source, source_port)
Return a generator for the responses to a zone transfer.
  _compute_expiration(timeout)
  _connect(s, address)
  _net_read(sock, count, expiration)
Read the specified number of bytes from sock.
  _net_write(sock, data, expiration)
Write the specified data to the socket.
  _wait_for(ir, iw, ix, expiration)
  _wait_for_readable(s, expiration)
  _wait_for_writable(s, expiration)

Function Details

tcp(q, where, timeout=None, port=53, af=None, source=None, source_port=0)

Return the response obtained after sending a query via TCP.
Parameters:
q - the query
           (type=dns.message.Message object)
where - where to send the message
           (type=string containing an IPv4 or IPv6 address)
timeout - The number of seconds to wait before the query times out. If None, the default, wait forever.
           (type=float)
port - The port to which to send the message. The default is 53.
           (type=int)
af - the address family to use. The default is None, which causes the address family to use to be inferred from the form of of where. If the inference attempt fails, AF_INET is used.
           (type=int)
source - source address. The default is the IPv4 wildcard address.
           (type=string)
source_port - The port from which to send the message. The default is 0.
           (type=int)
Returns:
dns.message.Message object

udp(q, where, timeout=None, port=53, af=None, source=None, source_port=0)

Return the response obtained after sending a query via UDP.
Parameters:
q - the query
           (type=dns.message.Message)
where - where to send the message
           (type=string containing an IPv4 or IPv6 address)
timeout - The number of seconds to wait before the query times out. If None, the default, wait forever.
           (type=float)
port - The port to which to send the message. The default is 53.
           (type=int)
af - the address family to use. The default is None, which causes the address family to use to be inferred from the form of of where. If the inference attempt fails, AF_INET is used.
           (type=int)
source - source address. The default is the IPv4 wildcard address.
           (type=string)
source_port - The port from which to send the message. The default is 0.
           (type=int)
Returns:
dns.message.Message object

xfr(where, zone, rdtype=252, rdclass=1, timeout=None, port=53, keyring=None, keyname=None, relativize=True, af=None, lifetime=None, source=None, source_port=0)

Return a generator for the responses to a zone transfer.
Parameters:
where - where to send the message
           (type=string containing an IPv4 or IPv6 address)
zone - The name of the zone to transfer
           (type=dns.name.Name object or string)
rdtype - The type of zone transfer. The default is dns.rdatatype.AXFR.
           (type=int or string)
rdclass - The class of the zone transfer. The default is dns.rdatatype.IN.
           (type=int or string)
timeout - The number of seconds to wait for each response message. If None, the default, wait forever.
           (type=float)
port - The port to which to send the message. The default is 53.
           (type=int)
keyring - The TSIG keyring to use
           (type=dict)
keyname - The name of the TSIG key to use
           (type=dns.name.Name object or string)
relativize - If True, all names in the zone will be relativized to the zone origin. It is essential that the relativize setting matches the one specified to dns.zone.from_xfr().
           (type=bool)
af - the address family to use. The default is None, which causes the address family to use to be inferred from the form of of where. If the inference attempt fails, AF_INET is used.
           (type=int)
lifetime - The total number of seconds to spend doing the transfer. If None, the default, then there is no limit on the time the transfer may take.
           (type=float)
source - source address. The default is the IPv4 wildcard address.
           (type=string)
source_port - The port from which to send the message. The default is 0.
           (type=int)
Returns:
generator of dns.message.Message objects.

_net_read(sock, count, expiration)

Read the specified number of bytes from sock. Keep trying until we either get the desired amount, or we hit EOF. A Timeout exception will be raised if the operation is not completed by the expiration time.

_net_write(sock, data, expiration)

Write the specified data to the socket. A Timeout exception will be raised if the operation is not completed by the expiration time.

Generated by Epydoc 2.1 on Fri Jun 2 14:38:20 2006 http://epydoc.sf.net