Py3DNS is a Python 3 library for making DNS queries and parsing responses. It provides a flexible API for various record types (A, AAAA, MX, NS, SOA, etc.) and is a port of the older `pydns` library, specifically adapted for Python 3. The current version is 4.0.2, with updates primarily focusing on Python compatibility, bug fixes, and feature enhancements like `asyncio` support.
pip install py3dnsVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to perform basic A and MX record DNS queries using Py3DNS. It includes name server discovery and a fallback to public DNS if discovery fails, making the example robust for various environments.
Ensure `py3dns` is installed (`pip install py3dns`). Review your existing `pydns` code and adjust for Python 3 syntax and module differences. Test thoroughly.
Call `DNS.DiscoverNameServers()` or `DNS.ParseResolvConf()` before making any `DNS.Request` calls to ensure name servers are properly set up. Alternatively, set `DNS.defaults['server'] = ['your_dns_server_ip']`.
For concurrent or non-blocking operations, consider using Py3DNS's `asyncio` integration (e.g., `DNS.async_req`) introduced in version 4.0.0, or manage concurrency using Python's `threading` or `multiprocessing` modules.
Verify that `py3dns` is installed in your active environment by running `pip install py3dns`. Ensure your Python interpreter matches the environment where `py3dns` is installed.
Before making any `DNS.Request`, ensure name servers are set up by calling `DNS.DiscoverNameServers()`, `DNS.ParseResolvConf()`, or by manually setting `DNS.defaults['server'] = ['IP_ADDRESS_1', 'IP_ADDRESS_2']`.
Increase the timeout value by setting `DNS.defaults['timeout'] = X` (where `X` is the timeout in seconds) before making the request. Also, check your network connectivity and the availability of your configured DNS servers.
No dependency data recorded yet.