import httpx
_CoreAsyncNetworkBackend = httpcore.AsyncNetworkBackend
- _CoreAnyIOStream = httpcore._backends.anyio.AnyIOStream
+ _CoreAnyIOStream = httpcore._backends.anyio.AnyIOStream # pyright: ignore
from dns.query import _compute_times, _expiration_for_this_attempt, _remaining
"""A dict of DNS stub resolver answers, indexed by type."""
+class EmptyHostAnswers(dns.exception.DNSException):
+ """The HostAnswers has no addresses"""
+
+
class HostAnswers(Answers):
"""A dict of DNS stub resolver answers to a host name lookup, indexed by
type.
# Returns the canonical name from this result.
def canonical_name(self) -> dns.name.Name:
answer = self.get(dns.rdatatype.AAAA, self.get(dns.rdatatype.A))
+ if answer is None:
+ raise EmptyHostAnswers
return answer.canonical_name