# PyNslookup
[![PyPi package](https://img.shields.io/pypi/v/nslookup.svg)](https://pypi.python.org/pypi/nslookup)
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](https://github.com/rthalley/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)
```python
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.
Raw data
{
"_id": null,
"home_page": "https://github.com/wesinator/pynslookup",
"name": "nslookup",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "dns",
"author": "wesinator",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/32/45/ef8e10cb885407fe4572f5079e1165286acfc6cd0fbe71fadf85ec40a7a2/nslookup-1.7.0.tar.gz",
"platform": null,
"description": "# PyNslookup\n[![PyPi package](https://img.shields.io/pypi/v/nslookup.svg)](https://pypi.python.org/pypi/nslookup)\n\nSimple, sensible high-level DNS lookups in Python (on top of dnspython dns.resolver).\n\n#### Purpose and scope\nThis library is a simple wrapper around [dnspython](https://github.com/rthalley/dnspython), \nto provide high level functions with good error/exception handling, for the most common basic DNS lookup cases.\n\n- `A`, `AAAA` record lookups (typical DNS queries)\n- SOA lookups\n\nThis is not intended to be a complete wrapper around dnspython library or to handle uncommon edge cases.\nFeatures like DoH are out of scope, and should be done using other libraries or dnspython directly.\n\n### Usage\n\nReturns an object containing two arrays:\n - `response_full`: the full DNS response string(s)\n - `answer`: the parsed DNS answer (list of IPs or SOA string)\n\n```python\nfrom nslookup import Nslookup\n\ndomain = \"example.com\"\n\n# Initialize Nslookup\ndns_query = Nslookup()\n# Alternatively, the Nslookup constructor supports optional\n# arguments for setting custom dns servers (defaults to system DNS),\n# verbosity (default: True) and using TCP instead of UDP (default: False)\ndns_query = Nslookup(dns_servers=[\"1.1.1.1\"], verbose=False, tcp=False)\n\nips_record = dns_query.dns_lookup(domain)\nprint(ips_record.response_full, ips_record.answer)\n\nsoa_record = dns_query.soa_lookup(domain)\nprint(soa_record.response_full, soa_record.answer)\n```\n\n### Note\nThis library is oriented around regular UDP DNS.\n\nUsing TCP modes in this simple library will create a separate TCP session for \neach query, which can be resource intensive for a large number of queries. \nFor this it is recommended to use the more granular `dnspython` API directly.\n\n\n",
"bugtrack_url": null,
"license": "",
"summary": "Sensible high-level DNS lookups in Python, using DNSpython resolver",
"version": "1.7.0",
"split_keywords": [
"dns"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "0d3a1f1e916e23509f8e30381561344594b56aec024067023e58a3c2e49dcfd1",
"md5": "dcff697859f7668c81e514db7f568c64",
"sha256": "7201ceea2278d3906ae4b682e2479012d7821a5fb3926ff5da47de7ff1c8625f"
},
"downloads": -1,
"filename": "nslookup-1.7.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "dcff697859f7668c81e514db7f568c64",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 9229,
"upload_time": "2023-02-11T15:13:23",
"upload_time_iso_8601": "2023-02-11T15:13:23.460125Z",
"url": "https://files.pythonhosted.org/packages/0d/3a/1f1e916e23509f8e30381561344594b56aec024067023e58a3c2e49dcfd1/nslookup-1.7.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "3245ef8e10cb885407fe4572f5079e1165286acfc6cd0fbe71fadf85ec40a7a2",
"md5": "708c2f86cb010c58bb46812dbf4ceba0",
"sha256": "348c582292a3241fe0de56c06e4be3b59f388c725304d3f4d7c1dff31c3687d4"
},
"downloads": -1,
"filename": "nslookup-1.7.0.tar.gz",
"has_sig": false,
"md5_digest": "708c2f86cb010c58bb46812dbf4ceba0",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 8840,
"upload_time": "2023-02-11T15:13:34",
"upload_time_iso_8601": "2023-02-11T15:13:34.510220Z",
"url": "https://files.pythonhosted.org/packages/32/45/ef8e10cb885407fe4572f5079e1165286acfc6cd0fbe71fadf85ec40a7a2/nslookup-1.7.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-02-11 15:13:34",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "wesinator",
"github_project": "pynslookup",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "nslookup"
}