The dns.message.QueryMessage Class¶
The dns.message.QueryMessage
class is used for ordinary DNS query messages.
- class dns.message.QueryMessage(id: Optional[int] = None)[source]¶
- canonical_name() dns.name.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() dns.message.ChainingResult [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 ChainingResult object.
The dns.message.ChainingResult Class¶
Objects of the dns.message.ChainingResult
class are returned by the
dns.message.QueryMessage.resolve_chaining()
method.
- class dns.message.ChainingResult(canonical_name: dns.name.Name, answer: Optional[dns.rrset.RRset], minimum_ttl: int, cnames: List[dns.rrset.RRset])[source]¶
The result of a call to dns.message.QueryMessage.resolve_chaining().
The
answer
attribute is the answer RRSet, orNone
if it doesn’t exist.The
canonical_name
attribute is the canonical name after all chaining has been applied (this is the same name asrrset.name
in cases where rrset is notNone
).The
minimum_ttl
attribute is the minimum TTL, i.e. the TTL to use if caching the data. It is the smallest of all the CNAME TTLs and either the answer TTL if it exists or the SOA TTL and SOA minimum values for negative answers.The
cnames
attribute is a list of all the CNAME RRSets followed to get to the canonical name.