MCPcopy Create free account
hub / github.com/rthalley/dnspython / make_query

Function make_query

dns/message.py:1749–1845  ·  view source on GitHub ↗

Make a query message. The query name, type, and class may all be specified either as objects of the appropriate type, or as strings. The query will have a randomly chosen query id, and its DNS flags will be set to dns.flags.RD. qname, a ``dns.name.Name`` or ``str``, the query

(
    qname: dns.name.Name | str,
    rdtype: dns.rdatatype.RdataType | str,
    rdclass: dns.rdataclass.RdataClass | str = dns.rdataclass.IN,
    use_edns: int | bool | None = None,
    want_dnssec: bool = False,
    ednsflags: int | None = None,
    payload: int | None = None,
    request_payload: int | None = None,
    options: List[dns.edns.Option] | None = None,
    idna_codec: dns.name.IDNACodec | None = None,
    id: int | None = None,
    flags: int = dns.flags.RD,
    pad: int = 0,
)

Source from the content-addressed store, hash-verified

1747
1748
1749def make_query(
1750 qname: dns.name.Name | str,
1751 rdtype: dns.rdatatype.RdataType | str,
1752 rdclass: dns.rdataclass.RdataClass | str = dns.rdataclass.IN,
1753 use_edns: int | bool | None = None,
1754 want_dnssec: bool = False,
1755 ednsflags: int | None = None,
1756 payload: int | None = None,
1757 request_payload: int | None = None,
1758 options: List[dns.edns.Option] | None = None,
1759 idna_codec: dns.name.IDNACodec | None = None,
1760 id: int | None = None,
1761 flags: int = dns.flags.RD,
1762 pad: int = 0,
1763) -> QueryMessage:
1764 """Make a query message.
1765
1766 The query name, type, and class may all be specified either
1767 as objects of the appropriate type, or as strings.
1768
1769 The query will have a randomly chosen query id, and its DNS flags
1770 will be set to dns.flags.RD.
1771
1772 qname, a ``dns.name.Name`` or ``str``, the query name.
1773
1774 *rdtype*, an ``int`` or ``str``, the desired rdata type.
1775
1776 *rdclass*, an ``int`` or ``str``, the desired rdata class; the default
1777 is class IN.
1778
1779 *use_edns*, an ``int``, ``bool`` or ``None``. The EDNS level to use; the
1780 default is ``None``. If ``None``, EDNS will be enabled only if other
1781 parameters (*ednsflags*, *payload*, *request_payload*, or *options*) are
1782 set.
1783 See the description of dns.message.Message.use_edns() for the possible
1784 values for use_edns and their meanings.
1785
1786 *want_dnssec*, a ``bool``. If ``True``, DNSSEC data is desired.
1787
1788 *ednsflags*, an ``int``, the EDNS flag values.
1789
1790 *payload*, an ``int``, is the EDNS sender's payload field, which is the
1791 maximum size of UDP datagram the sender can handle. I.e. how big
1792 a response to this message can be.
1793
1794 *request_payload*, an ``int``, is the EDNS payload size to use when
1795 sending this message. If not specified, defaults to the value of
1796 *payload*.
1797
1798 *options*, a list of ``dns.edns.Option`` objects or ``None``, the EDNS
1799 options.
1800
1801 *idna_codec*, a ``dns.name.IDNACodec``, specifies the IDNA
1802 encoder/decoder. If ``None``, the default IDNA 2003 encoder/decoder
1803 is used.
1804
1805 *id*, an ``int`` or ``None``, the desired query id. The default is
1806 ``None``, which generates a random query id.

Callers

nothing calls this directly

Calls 6

QueryMessageClass · 0.85
want_dnssecMethod · 0.80
from_textMethod · 0.45
makeMethod · 0.45
find_rrsetMethod · 0.45
use_ednsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…