The functions in this module match those in libevent as closely as possible yet they return the result instead of passing it to a callback. The calling greenlet remains blocked until the result is ready.
A subclass of socket.gaierror used by evdns functions to report errors.
It uses evdns-specific error codes that are different from the standard socket errors.
>>> resolve_ipv4('aaaaaaaaaaa')
Traceback (most recent call last):
...
DNSError: [Errno 3] name does not exist
Lookup an A record for a given name. To disable searching for this query, set flags to QUERY_NO_SEARCH.
Returns (ttl, list of packed IPs).
>>> resolve_ipv4('www.python.org')
(10000, ['R^\xa4\xa2'])
Lookup an AAAA record for a given name. To disable searching for this query, set flags to QUERY_NO_SEARCH.
Returns (ttl, list of packed IPs).
Lookup a PTR record for a given IP address. To disable searching for this query, set flags to QUERY_NO_SEARCH.
>>> packed_ip = socket.inet_aton('82.94.164.162')
>>> resolve_reverse(packed_ip)
(10000, 'www.python.org')