Install & Compatibility
Where this runs
tested against v10.1.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.910 runs
installs and imports cleanly · install 0.0s · import 3.631s · 644.5MB
glibcpy 3.10–3.910 runs
installs and imports cleanly · install 32.4s · import 3.478s · 645MB
576MB installed
● package 576MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
parse_aggregate_report_xml
✓ from parsedmarc import parse_aggregate_report_xml
✗ import parsedmarc; parsedmarc.parse_aggregate_report_xml
Common mistake: using module-level import instead of submodule
parse_forensic_report_xml
✓ from parsedmarc import parse_forensic_report_xml
✗ parsedmarc.parse_forensic_report_xml
Direct function access without import works but less explicit
ParsedReport
✓ from parsedmarc import ParsedReport
This class is available in newer versions (8.x+). Older versions used a different internal structure.
Minimal example to parse an aggregate DMARC XML report.
import os
from parsedmarc import parse_aggregate_report_xml
# Example: parse an aggregate DMARC report from a file
with open('aggregate_report.xml', 'r') as f:
xml_data = f.read()
parsed = parse_aggregate_report_xml(xml_data)
print(parsed)
# If using IMAP, ensure credentials are set (optional)
os.environ.get('IMAP_HOST', 'imap.example.com')
parsedmarc --version
Errors
Common errors & fixes
AttributeError: 'str' object has no attribute 'decode'
Python 3 compatibility: bytes.decode() used, but string passed.
fixEnsure the input to parse_* functions is a string (not bytes). Use .decode() if reading from binary mode.
ModuleNotFoundError: No module named 'parsedmarc.resources'
Missing resource package in installation; usually happens with older pip or incomplete install.
fixUpgrade pip and reinstall: pip install --upgrade parsedmarc
KeyError: 'email' in parsedmarc.resources.files
Internal resource reading error due to broken package, often after upgrading from very old version.
fixUninstall and reinstall: pip uninstall parsedmarc -y; pip install parsedmarc
TypeError: '>' not supported between instances of 'str' and 'int'
Comparing version strings incorrectly; custom code sometimes passes wrong types.
fixUse parsedmarc.__version__ (string) and parse with packaging.version.parse for comparisons.
Upgrade
Version history
10.1.1latest on PyPI · released Jun 14, 2026
Audit
Dependencies
elasticsearchoptionalOptional dependency for Elasticsearch output
geoip2optionalOptional dependency for GeoIP lookups
kafka-pythonoptionalOptional dependency for Kafka output
pyspfoptionalOptional dependency for SPF checks
pythreatgrid2optionalOptional dependency for Threat Grid integration