The dns.message.QueryMessage Class

The dns.update.QueryMessage class is used for ordinary DNS query messages.

class dns.message.QueryMessage(id=None)[source]
canonical_name()[source]

Return the canonical name of the first name in the question section.

Raises dns.message.NotQueryResponse if the message is not a response.

Raises dns.message.ChainTooLong if the CNAME chain is too long.

Raises dns.message.AnswerForNXDOMAIN if the rcode is NXDOMAIN but an answer was found.

Raises dns.exception.FormError if the question count is not 1.

resolve_chaining()[source]

Follow the CNAME chain in the response to determine the answer RRset.

Raises dns.message.NotQueryResponse if the message is not a response.

Raises dns.message.ChainTooLong if the CNAME chain is too long.

Raises dns.message.AnswerForNXDOMAIN if the rcode is NXDOMAIN but an answer was found.

Raises dns.exception.FormError if the question count is not 1.

Returns a tuple (dns.name.Name, int, rrset) where the name is the canonical name, the int is the minimized TTL, and rrset is their answer RRset, which may be None if the chain was dangling or the response is an NXDOMAIN.