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

Function https

dns/query.py:443–647  ·  view source on GitHub ↗

Return the response obtained after sending a query via DNS-over-HTTPS. *q*, a ``dns.message.Message``, the query to send. *where*, a ``str``, the nameserver IP address or the full URL. If an IP address is given, the URL will be constructed using the following schema: https://<IP-ad

(
    q: dns.message.Message,
    where: str,
    timeout: float | None = None,
    port: int = 443,
    source: str | None = None,
    source_port: int = 0,
    one_rr_per_rrset: bool = False,
    ignore_trailing: bool = False,
    session: Any | None = None,
    path: str = "/dns-query",
    post: bool = True,
    bootstrap_address: str | None = None,
    verify: bool | str | ssl.SSLContext = True,
    resolver: Optional["dns.resolver.Resolver"] = None,  # pyright: ignore
    family: int = socket.AF_UNSPEC,
    http_version: HTTPVersion = HTTPVersion.DEFAULT,
)

Source from the content-addressed store, hash-verified

441
442
443def https(
444 q: dns.message.Message,
445 where: str,
446 timeout: float | None = None,
447 port: int = 443,
448 source: str | None = None,
449 source_port: int = 0,
450 one_rr_per_rrset: bool = False,
451 ignore_trailing: bool = False,
452 session: Any | None = None,
453 path: str = "/dns-query",
454 post: bool = True,
455 bootstrap_address: str | None = None,
456 verify: bool | str | ssl.SSLContext = True,
457 resolver: Optional["dns.resolver.Resolver"] = None, # pyright: ignore
458 family: int = socket.AF_UNSPEC,
459 http_version: HTTPVersion = HTTPVersion.DEFAULT,
460) -> dns.message.Message:
461 """Return the response obtained after sending a query via DNS-over-HTTPS.
462
463 *q*, a ``dns.message.Message``, the query to send.
464
465 *where*, a ``str``, the nameserver IP address or the full URL. If an IP address is
466 given, the URL will be constructed using the following schema:
467 https://<IP-address>:<port>/<path>.
468
469 *timeout*, a ``float`` or ``None``, the number of seconds to wait before the query
470 times out. If ``None``, the default, wait forever.
471
472 *port*, a ``int``, the port to send the query to. The default is 443.
473
474 *source*, a ``str`` containing an IPv4 or IPv6 address, specifying the source
475 address. The default is the wildcard address.
476
477 *source_port*, an ``int``, the port from which to send the message. The default is
478 0.
479
480 *one_rr_per_rrset*, a ``bool``. If ``True``, put each RR into its own RRset.
481
482 *ignore_trailing*, a ``bool``. If ``True``, ignore trailing junk at end of the
483 received message.
484
485 *session*, an ``httpx.Client``. If provided, the client session to use to send the
486 queries.
487
488 *path*, a ``str``. If *where* is an IP address, then *path* will be used to
489 construct the URL to send the DNS query to.
490
491 *post*, a ``bool``. If ``True``, the default, POST method will be used.
492
493 *bootstrap_address*, a ``str``, the IP address to use to bypass resolution.
494
495 *verify*, a ``bool`` or ``str``. If a ``True``, then TLS certificate verification
496 of the server is done using the default CA bundle; if ``False``, then no
497 verification is done; if a `str` then it specifies the path to a certificate file or
498 directory which will be used for verification.
499
500 *resolver*, a ``dns.resolver.Resolver`` or ``None``, the resolver to use for

Callers

nothing calls this directly

Calls 11

_destination_and_sourceFunction · 0.85
addressesMethod · 0.80
is_responseMethod · 0.80
_maybe_get_resolverFunction · 0.70
_http3Function · 0.70
_HTTPTransportClass · 0.70
resolve_nameMethod · 0.45
to_wireMethod · 0.45
updateMethod · 0.45
decodeMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…