Asyncio Python DNS resolver
Project description
aiodnsresolver
Asyncio Python DNS resolver. Pure Python, with no dependencies other than the standard library, threads are not used, and all code is in a single module. The nameservers to query are taken from /etc/resolve.conf
.
Based on https://github.com/gera2ld/async_dns.
Installation
pip install aiodnsresolver
Usage
from aiodnsresolver import Resolver, TYPE_A
resolve = Resolver()
ip_addresses = await resolve('www.google.com', TYPE_A)
Scope
The scope of this project is deliberately restricted to operations that are used to resolve A or AAAA records: to resolve a domain name to one of its IP addresses, and have similar responsibilities to gethostbyname
. Some limited extra behaviour is present/may be added, but great care is taken to prevent scope creep, especially to not add complexity that isn't required to resolve A or AAAA records.
-
UDP queries are made, but not TCP. DNS servers must support UDP; and for a A and AAAA records, it's impossible for such a record to not fit into the maximum size of a UDP DNS response, 512 bytes. There may be other data that the DNS server would return in TCP connections, but this isn't required to resolve a domain name to a single IP address.
-
CNAME records are followed transparently.
-
Responses are cached, adhering to their TTL.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for aiodnsresolver-0.0.31-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7d0bbe1cdea2e5f6548bfb1be19273a1d73634b48913c08c93c4183ec9dfc0ad |
|
MD5 | 62c7840eea9a1cd7c2e32724c89ce459 |
|
BLAKE2b-256 | 1c9c032c6c4a0d99337e1483f2b14b5e22a8c49155011c6d976249c75dcfa6f9 |