The dns.message.QueryMessage Class
The dns.message.QueryMessage class is used for ordinary DNS query messages.
- class dns.message.QueryMessage(id: int | None = None)[source]
- canonical_name() Name[source]
Return the canonical name of the first name in the question section.
Raises
dns.message.NotQueryResponseif the message is not a response.Raises
dns.message.ChainTooLongif the CNAME chain is too long.Raises
dns.message.AnswerForNXDOMAINif the rcode is NXDOMAIN but an answer was found.Raises
dns.exception.FormErrorif the question count is not 1.
- resolve_chaining() ChainingResult[source]
Follow the CNAME chain in the response to determine the answer RRset.
Raises
dns.message.NotQueryResponseif the message is not a response.Raises
dns.message.ChainTooLongif the CNAME chain is too long.Raises
dns.message.AnswerForNXDOMAINif the rcode is NXDOMAIN but an answer was found.Raises
dns.exception.FormErrorif 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: Name, answer: RRset | None, minimum_ttl: int, cnames: List[RRset])[source]
The result of a call to dns.message.QueryMessage.resolve_chaining().
The
answerattribute is the answer RRSet, orNoneif it doesn’t exist.The
canonical_nameattribute is the canonical name after all chaining has been applied (this is the same name asrrset.namein cases where rrset is notNone).The
minimum_ttlattribute 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
cnamesattribute is a list of all the CNAME RRSets followed to get to the canonical name.