Re: Best approach for bulk DNS lookups in Python — socke t vs dnspython vs asyncio

Cynthia Marshal via Python-list <[email protected]> Tue, 10 Mar 2026 21:27:19 -0000
Newsgroups gmane.comp.python.general
Message-ID <[email protected]>
For this kind of bulk lookup, dnspython is usually fine, but performance often depends more on resolver settings, timeout, retry behavior, and concurrency limits than on the library alone. socket.getaddrinfo will not help for MX/TXT, and calling dig in subprocesses is usually not worth the overhead unless you need exact system-tool behavior.

asyncio + aiodns can be faster for large batches, but it may add complexity and occasional resolver quirks. Before switching, you may want to tune your current dnspython resolver and test higher concurrency carefully. Your idea of verifying results with https://dnsrobot.net/spf-checker
 is also a good way to spot-check SPF, DKIM, and DMARC output.