Skip to main content

PyNslookup

PyPi package

Simple, sensible high-level DNS lookups in Python (on top of dnspython dns.resolver).

Purpose and scope

This library is a simple wrapper around dnspython, to provide high level functions with good error/exception handling, for the most common basic DNS lookup cases.

  • A, AAAA record lookups (typical DNS queries)
  • SOA lookups

This is not intended to be a complete wrapper around dnspython library or to handle uncommon edge cases. Features like DoH are out of scope, and should be done using other libraries or dnspython directly.

Usage

Returns an object containing two arrays:

  • response_full: the full DNS response string(s)
  • answer: the parsed DNS answer (list of IPs or SOA string)
from nslookup import Nslookup

domain = "example.com"

# Initialize Nslookup
dns_query = Nslookup()
# Alternatively, the Nslookup constructor supports optional
# arguments for setting custom dns servers (defaults to system DNS),
# verbosity (default: True) and using TCP instead of UDP (default: False)
dns_query = Nslookup(dns_servers=["1.1.1.1"], verbose=False, tcp=False)

ips_record = dns_query.dns_lookup(domain)
print(ips_record.response_full, ips_record.answer)

soa_record = dns_query.soa_lookup(domain)
print(soa_record.response_full, soa_record.answer)

Note

This library is oriented around regular UDP DNS.

Using TCP modes in this simple library will create a separate TCP session for each query, which can be resource intensive for a large number of queries. For this it is recommended to use the more granular dnspython API directly.

Release files for nslookup 1.9.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nslookup 1.9.0
File Size Uploaded
nslookup-1.9.0.tar.gz 9.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for nslookup 1.9.0
File Interpreter ABI Platform
nslookup-1.9.0-py3-none-any.whl Python 3 none any Details

Total release size: 18.5 kB

Release files / nslookup-1.9.0.tar.gz

Download URL nslookup-1.9.0.tar.gz
Size 9.0 kB
Tags Source
SHA-256 checksum
How to use checksums
8e660032fe1afcf16750e82e47f43f13548f9ff3228a580bf730df5585f02820
BLAKE2b-256 checksum
How to use checksums
e1791fe730c666eb089703b30a274c0763ee1529f1dcedd6baaed31bc889cbb8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.10.12

Release files / nslookup-1.9.0-py3-none-any.whl

Download URL nslookup-1.9.0-py3-none-any.whl
Size 9.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c904118862ec71ec9bdd8d9988792d3ed1fe11ab84d3e5a17fdc8deca8224c8b
BLAKE2b-256 checksum
How to use checksums
83adbc7a3ce91ccf5984c0e85074e007cfadbc97cbdfe75b7fb70e1d4c829054
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.10.12

Release history Release notifications | RSS feed

This release

1.9.0 This release

2 release files

1.8.1

2 release files

1.8.0

2 release files

1.7.0

2 release files

1.6.2

2 release files

1.6.1

2 release files

1.6.0

2 release files

1.5.1

2 release files

1.5.0

2 release files

1.4.0

2 release files

1.3.0

2 release files

1.2.0

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.5.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page