dns-lexicon is a Python library that provides a standardized and agnostic way to manipulate DNS records across various DNS providers. It abstracts away provider-specific APIs, allowing users to manage DNS records programmatically or via a command-line interface. The library is actively maintained with frequent minor releases, typically on a monthly basis, adding new providers and fixing existing ones. The current version is 3.23.2.
pip install dns-lexiconVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize a `Client` for a specific DNS provider (e.g., Cloudflare) using API credentials from environment variables or direct input, and then how to list existing DNS records for a domain. It also includes commented-out examples for creating and deleting records, which require careful use.
Update your provider configuration from `linode` to `linode4` if you are using the Linode DNS service. Review the changelog for other provider renames/removals.
Ensure your Python environment is running Python 3.10 or newer. Upgrade your Python installation if necessary.
Always refer to the official dns-lexicon documentation for the specific provider you are using (e.g., `cloudflare`, `godaddy`) to understand the exact authentication parameters required for the `Client` configuration dictionary.
When creating or updating records, ensure that the `name`, `content`, and `ttl` parameters adhere to the specific requirements of your DNS provider. For instance, `godaddy` provider in v3.18.0 improved behavior with invalid TTLs and subdomains.
Check the spelling of the provider name. Refer to the dns-lexicon documentation or GitHub repository to find the list of supported providers and their exact names (e.g., 'cloudflare', 'godaddy', 'linode4').
Double-check your API credentials against your DNS provider's dashboard. Ensure they are correctly passed in the `config` dictionary and have the required permissions for DNS record management. Also, verify that the correct credential key names are used for your specific provider (e.g., `cloudflare_token`, `godaddy_secret`).
Verify that the `rtype` (record type, e.g., 'A', 'AAAA', 'CNAME', 'TXT', 'MX') and `content` are consistent and valid according to DNS standards and your provider's API documentation. For instance, an 'A' record needs an IPv4 address, and a 'CNAME' record needs a hostname.
No dependency data recorded yet.