Asynchronous Resolver Functions¶
- async dns.asyncresolver.resolve(qname: Union[dns.name.Name, str], rdtype: Union[dns.rdatatype.RdataType, str] = RdataType.A, rdclass: Union[dns.rdataclass.RdataClass, str] = RdataClass.IN, tcp: bool = False, source: Optional[str] = None, raise_on_no_answer: bool = True, source_port: int = 0, lifetime: Optional[float] = None, search: Optional[bool] = None, backend: Optional[dns._asyncbackend.Backend] = None) dns.resolver.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) dns.resolver.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: Union[dns.name.Name, str], family: int = AddressFamily.AF_UNSPEC, **kwargs: Any) dns.resolver.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: Union[dns.name.Name, str]) dns.name.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: Union[dns.name.Name, str], rdclass: dns.rdataclass.RdataClass = RdataClass.IN, tcp: bool = False, resolver: Optional[dns.asyncresolver.Resolver] = None, backend: Optional[dns._asyncbackend.Backend] = None) dns.name.Name [source]¶
Find the name of the zone which contains the specified name.
See
dns.resolver.Resolver.zone_for_name()
for more information on the parameters and possible exceptions.
- async dns.asyncresolver.make_resolver_at(where: Union[dns.name.Name, str], port: int = 53, family: int = AddressFamily.AF_UNSPEC, resolver: Optional[dns.asyncresolver.Resolver] = None) dns.asyncresolver.Resolver [source]¶
Make a stub resolver using the specified destination as the full resolver.
where, a
dns.name.Name
orstr
the domain name or IP address of the full resolver.port, an
int
, the port to use. If not specified, the default is 53.family, an
int
, the address family to use. This parameter is used if where is not an address. The default issocket.AF_UNSPEC
in which case the first address returned byresolve_name()
will be used, otherwise the first address of the specified family will be used.resolver, a
dns.asyncresolver.Resolver
orNone
, the resolver to use for resolution of hostnames. If not specified, the default resolver will be used.Returns a
dns.resolver.Resolver
or raises an exception.
- async dns.asyncresolver.resolve_at(where: Union[dns.name.Name, str], qname: Union[dns.name.Name, str], rdtype: Union[dns.rdatatype.RdataType, str] = RdataType.A, rdclass: Union[dns.rdataclass.RdataClass, str] = RdataClass.IN, tcp: bool = False, source: Optional[str] = None, raise_on_no_answer: bool = True, source_port: int = 0, lifetime: Optional[float] = None, search: Optional[bool] = None, backend: Optional[dns._asyncbackend.Backend] = None, port: int = 53, family: int = AddressFamily.AF_UNSPEC, resolver: Optional[dns.asyncresolver.Resolver] = None) dns.resolver.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.resolve
for more information on the resolution parameters, anddns.asyncresolver.make_resolver_at
for 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¶
- dns.asyncresolver.get_default_resolver() dns.asyncresolver.Resolver [source]¶
Get the default asynchronous resolver, initializing it if necessary.