checkdmarc
raw JSON → 5.15.2 verified Mon Apr 27 auth: no python
A Python module and CLI tool for parsing and validating SPF and DMARC DNS records. Current version 5.15.2. Release cadence is irregular with periodic fixes and breaking changes.
pip install checkdmarc Common errors
error ModuleNotFoundError: No module named 'checkdmarc' ↓
cause Library not installed or installed in wrong environment.
fix
Run 'pip install checkdmarc' in the correct Python environment.
error TypeError: check_domains() got an unexpected keyword argument 'timeout_retries' ↓
cause Parameter renamed in version 5.15.0.
fix
Use 'retries' instead of 'timeout_retries'.
error dns.resolver.LifetimeTimeout ↓
cause DNS query timed out, often due to network issues or retries=0 default.
fix
Increase 'retries' (e.g., retries=2) or set a higher 'timeout'.
error checkdmarc.exceptions.SPFError: No SPF record found ↓
cause Domain has no SPF TXT record.
fix
Add an SPF record to the domain's DNS zone.
Warnings
breaking In 5.15.0, the 'timeout_retries' parameter was renamed to 'retries' and the default changed from 2 to 0. ↓
fix Replace keyword argument 'timeout_retries' with 'retries' in all calls. Set retries explicitly if relying on the old default.
breaking In 5.16.0, when 'nameservers' is None, checkdmarc now falls back to system resolvers instead of auto-configuring public DNS. This reverts a 5.15.0 change. ↓
fix If you depend on auto-configured public resolvers, pass nameservers=['1.1.1.1','8.8.8.8'] explicitly.
deprecated The 'timeout' parameter may be deprecated in future; use 'retries' for retry behavior. ↓
fix Prefer setting 'retries' and 'timeout' separately if needed.
gotcha The library may raise 'dns.resolver.LifetimeTimeout' for DNS timeouts, especially when using default retries (0 since 5.15.0). ↓
fix Set retries>=1 to mitigate transient failures.
gotcha When checking domains with no MX records, the module no longer emits a warning (since 5.10.12). ↓
fix Expect 'mx' key to be absent or empty in results.
Imports
- check_domains
from checkdmarc import check_domains - check_domain
from checkdmarc import check_domain - SPFResult
from checkdmarc.types import SPFResult - DMARCResult
from checkdmarc.types import DMARCResult
Quickstart
from checkdmarc import check_domains
import os
result = check_domains(['example.com'], nameservers=['1.1.1.1'])
print(result)