PyNslookup
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,AAAArecord 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)
| File | Size | Uploaded | |
|---|---|---|---|
| nslookup-1.9.0.tar.gz | 9.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| 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
|