py3dns
Python 3 DNS library
What it is and what it does
py3dns is a Python 3 port of the original pydns library, providing a straightforward interface for making DNS queries. It handles nameserver discovery from system configuration, supports multiple nameservers with fallback, and returns results in useful formats—including ipaddress objects for A and AAAA queries by default. The package includes convenience functions for reverse DNS and MX record queries.
The library is synchronous only; async DNS support was removed in version 4.0.0. With no runtime dependencies and low install friction, py3dns is a minimal, self-contained option for basic DNS lookups in Python 3 applications, though its dormant maintenance status means no active development or bug fixes.
Use it for:
- Perform reverse DNS lookups to resolve IP addresses to hostnames in network monitoring or logging.
- Query MX records to validate email domain configurations or build mail server lists.
- Look up A/AAAA records to resolve domain names to IP addresses in custom DNS clients or network tools.
- Retrieve SOA records to check zone authority and serial numbers for DNS administration tasks.
- Build DNS query utilities or diagnostic tools that need synchronous, lightweight DNS resolution.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides synchronous DNS query functionality for Python 3, supporting common record types with configurable nameservers and result formatting.
Yes, if you need lightweight synchronous DNS queries and can accept dormant maintenance. The package is stable, has no dependencies, and works reliably for basic DNS lookups in Python >=3.2. No, if you require async DNS, active maintenance, or clarity on licensing terms before deployment. The unclear license treatment warrants verification before use in proprietary contexts.
Install
py3dns on PyPI
pip
pip install py3dnsuv
uv add py3dnspoetry
poetry add py3dnsInstalling py3dns
Before you install
Low install friction with no runtime dependencies. Dormant maintenance status (799 days since last release) means no active development, though the package remains functional for its stated purpose.
License in practice
License treatment is unclear—no SPDX identifier or explicit raw license text is available in the metadata, despite classifiers indicating Python License (CNRI Python License). Verify the actual license terms before use in proprietary or restricted contexts.
Quickstart
pip install py3dns
import DNS
req = DNS.Request()
result = req.req('example.com', qtype='A')
Requires Python >=3.2; async DNS queries are not supported (removed in version 4.0.0).
Verify before relying
- Whether the Python License (CNRI Python License) is compatible with your project's licensing requirements.
- Current stability and compatibility with Python versions beyond 3.2, given dormant maintenance status.
- Whether the package handles edge cases in modern DNS environments or has known limitations with certain record types.
Package facts
| License | not declared (unclear) |
| Python support | supports the current Python release (>=3.2) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | dormant — 799 days since the last release |
| First released | |
| Downloads | 128,033/month — #11,722 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: py3dns-4.0.2-py3-none-any.whl
Keywords: DNS
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
aiodnsProvides asynchronous DNS resolution for…
permissive · top 5,000 on PyPI
nslookupProvides high-level DNS lookups (A, AAAA, and…
copyleft · top 15,000 on PyPI
dnslibEncodes and decodes DNS wire-format packets,…
permissive · top 5,000 on PyPI
pycarespycares provides a Python interface to c-ares,…
permissive · top 5,000 on PyPI
dnspythondnspython is a DNS toolkit that handles…
permissive · top 1,000 on PyPI
ipaddressProvides IPv4 and IPv6 address manipulation for…
permissive · top 5,000 on PyPI
azure-mgmt-dnsManages Azure DNS resources—zones, record sets,…
permissive · top 5,000 on PyPI
zeroconfDiscovers and registers services on local…
copyleft · top 5,000 on PyPI
dns-lexicondns-lexicon provides a unified Python interface…
permissive · top 15,000 on PyPI
aiodiscoverDiscovers hosts on a local network by…
permissive · top 15,000 on PyPI