nslookup
Sensible high-level DNS lookups in Python, using DNSpython resolver
What it is and what it does
Nslookup is a lightweight wrapper around dnspython that simplifies DNS queries for the most common use cases: looking up A and AAAA records to resolve domain names to IP addresses, and SOA record queries. It abstracts away dnspython's lower-level API to provide straightforward functions that return parsed results and full response strings, with sensible error handling built in.
The library is intentionally narrow in scope—it does not attempt to cover all DNS record types or edge cases, and features like DNS-over-HTTPS are explicitly out of scope. It defaults to UDP queries against system DNS servers but supports custom DNS servers and TCP mode, though the documentation notes that TCP mode creates a new session per query and is resource-intensive for bulk operations.
Use it for:
- Resolve domain names to IP addresses in a Python application without wrestling with dnspython's full API
- Perform SOA record lookups to check domain authority or delegation details
- Query against a specific DNS server (e.g., 1.1.1.1) instead of relying on system defaults
- Add DNS resolution to a simple script or tool with minimal dependencies and setup
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides high-level DNS lookups (A, AAAA, and SOA records) with clean error handling, wrapping dnspython's resolver for common query patterns.
Yes, if you need straightforward DNS lookups for A, AAAA, or SOA records. The single dependency, active maintenance, and low install friction make it a sensible choice for common queries. Skip it if you need advanced DNS features (other record types, DoH, complex error recovery) or bulk TCP queries—use dnspython directly instead.
Install
nslookup on PyPI
pip
pip install nslookupuv
uv add nslookuppoetry
poetry add nslookupInstalling nslookup
Before you install
Low friction install with a single runtime dependency (dnspython). Actively maintained with recent commits; repository is not archived.
License in practice
Licensed under Mozilla Public License 2.0 (MPL 2.0), a copyleft license requiring derivative works to disclose modifications under the same license terms.
Quickstart
pip install nslookup
from nslookup import Nslookup
dns_query = Nslookup()
ips_record = dns_query.dns_lookup("example.com")
print(ips_record.answer)
Verify before relying
- Whether the library handles DNS timeouts, retries, or connection failures beyond basic exception handling
- Performance characteristics when querying many domains in sequence
- Whether custom DNS server configuration works reliably across different network environments
Package facts
| License | not declared (copyleft) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — dnspython |
| Maintenance | actively maintained — 103 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 107,556/month — #12,609 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: nslookup-1.9.0-py3-none-any.whl
Keywords: dns
Tags
More Internet packages
Botocore provides low-level, data-driven access…
permissive · top 100 on PyPI
aiobotocoreProvides an async client for AWS services using…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
filelockProvides a platform-independent file locking…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
googleapis-common-protosProvides common Protocol Buffer message…
permissive · top 100 on PyPI
dnspythondnspython is a DNS toolkit that handles…
permissive · top 1,000 on PyPI
dnslibEncodes and decodes DNS wire-format packets,…
permissive · top 5,000 on PyPI
ipwhoisRetrieves and parses whois and RDAP data for…
permissive · top 15,000 on PyPI
aiodnsProvides asynchronous DNS resolution for…
permissive · top 5,000 on PyPI
pycarespycares provides a Python interface to c-ares,…
permissive · top 5,000 on PyPI
PyFunceble-devPyFunceble checks whether domains, IPs, and…
permissive · top 15,000 on PyPI
dns-lexicondns-lexicon provides a unified Python interface…
permissive · top 15,000 on PyPI
shodanProvides Python access to Shodan's search…
permissive · top 15,000 on PyPI
aiohttp-asyncmdnsresolverProvides an async resolver for aiohttp that…
permissive · top 15,000 on PyPI
class-resolverDynamically lookup and instantiate classes by…
permissive · top 15,000 on PyPI