Asynchronous Resolver Functions
- async dns.asyncresolver.resolve(qname: Name | str, rdtype: RdataType | str = RdataType.A, rdclass: RdataClass | str = RdataClass.IN, tcp: bool = False, source: str | None = None, raise_on_no_answer: bool = True, source_port: int = 0, lifetime: float | None = None, search: bool | None = None, backend: Backend | None = None) Answer[source]
Query nameservers asynchronously to find the answer to the question.
This is a convenience function that uses the default resolver object to make the query.
See
dns.asyncresolver.Resolver.resolve()for more information on the parameters.
- async dns.asyncresolver.resolve_address(ipaddr: str, *args: Any, **kwargs: Any) Answer[source]
Use a resolver to run a reverse query for PTR records.
See
dns.asyncresolver.Resolver.resolve_address()for more information on the parameters.
- async dns.asyncresolver.resolve_name(name: Name | str, family: int = AddressFamily.AF_UNSPEC, **kwargs: Any) HostAnswers[source]
Use a resolver to asynchronously query for address records.
See
dns.asyncresolver.Resolver.resolve_name()for more information on the parameters.
- async dns.asyncresolver.canonical_name(name: Name | str) Name[source]
Determine the canonical name of name.
See
dns.resolver.Resolver.canonical_name()for more information on the parameters and possible exceptions.
- async dns.asyncresolver.try_ddr(timeout: float = 5.0) None[source]
Try to update the default resolver’s nameservers using Discovery of Designated Resolvers (DDR). If successful, the resolver will subsequently use DNS-over-HTTPS or DNS-over-TLS for future queries.
See
dns.resolver.Resolver.try_ddr()for more information.
- async dns.asyncresolver.zone_for_name(name: Name | str, rdclass: RdataClass = RdataClass.IN, tcp: bool = False, resolver: Resolver | None = None, backend: Backend | None = None) Name[source]
Find the name of the zone which contains the specified name.
See
dns.resolver.zone_for_name()for more information on the parameters and possible exceptions.
- async dns.asyncresolver.make_resolver_at(where: Name | str, port: int = 53, family: int = AddressFamily.AF_UNSPEC, resolver: Resolver | None = None) Resolver[source]
Make a stub resolver using the specified destination as the full resolver.
- Parameters:
where (
dns.name.Nameor str) – The domain name or IP address of the full resolver.port (int) – The port to use. Default is 53.
family (int) – The address family. Used only when where is not an address literal.
socket.AF_UNSPEC(default) uses the first address returned; otherwise the first address of the given family.resolver (
dns.asyncresolver.ResolverorNone) – The resolver to use for hostname resolution. IfNone, the default resolver is used.
- Return type:
- async dns.asyncresolver.resolve_at(where: Name | str, qname: Name | str, rdtype: RdataType | str = RdataType.A, rdclass: RdataClass | str = RdataClass.IN, tcp: bool = False, source: str | None = None, raise_on_no_answer: bool = True, source_port: int = 0, lifetime: float | None = None, search: bool | None = None, backend: Backend | None = None, port: int = 53, family: int = AddressFamily.AF_UNSPEC, resolver: Resolver | None = None) Answer[source]
Query nameservers to find the answer to the question.
This is a convenience function that calls
dns.asyncresolver.make_resolver_at()to make a resolver, and then uses it to resolve the query.See
dns.asyncresolver.Resolver.resolvefor more information on the resolution parameters, anddns.asyncresolver.make_resolver_atfor information about the resolver parameters where, port, family, and resolver.If making more than one query, it is more efficient to call
dns.asyncresolver.make_resolver_at()and then use that resolver for the queries instead of callingresolve_at()multiple times.
- dns.asyncresolver.default_resolver = None