Parse and evaluate DMARC email authentication policy
Project description
DMARC (Domain-based Message Authentication, Reporting & Conformance)
DMARC email authentication module implemented in Python.
Installation
Use the package manager pip to install dmarc.
pip install dmarc
Usage
>>> import dmarc
>>>
>>> # represent verified SPF and DKIM status
>>> aspf = dmarc.SPF(domain='news.example.com', result=dmarc.SPF_PASS)
>>> adkim = dmarc.DKIM(domain='example.com', result=dmarc.DKIM_PASS)
>>> try:
... admarc = dmarc.DMARCPolicy(record='v=DMARC1; p=reject;', domain='example.com')
... admarc.verify(spf=aspf, dkim=adkim)
... adict = admarc.result.as_dict() # dict repr
... except dmarc.PolicyNoneError:
... pass
... except dmarc.PolicyQuarantineError:
... raise
... except dmarc.PolicyRejectError:
... raise
... except dmarc.RecordSyntaxError:
... raise
...
License
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
dmarc-1.0.4.tar.gz
(5.9 kB
view hashes)
Built Distribution
dmarc-1.0.4-py3-none-any.whl
(6.3 kB
view hashes)