Registry / aws / parsedmarc

parsedmarc

JSON →
library10.1.1pypypi✓ verified 84d ago

A Python package and CLI for parsing aggregate and forensic DMARC reports. Current version 9.10.3, requires Python >=3.10. Released regularly with new features and bug fixes.

pip install parsedmarc
INSTALL
IMPORT
SIG · PARSEDMARC
P
parsedmarc
awspythonv10.1.1
Install
32.4s avg
Import
3555ms
Disk
576MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
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
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 3.631s · 644.5MB
glibc
py 3.103.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
Debug
Known issues
breakingIn version 8.0.0, the output format from parsedmarc changed from a list of dictionaries to a list of ParsedReport objects. Code relying on dictionary keys will break.
fix
Access attributes via the ParsedReport object (e.g., report.policy_published) instead of dict keys.
affects: >=8.0.0
breakingSupport for Python 3.6 was dropped in version 7.0.0; Python 3.9 dropped in 9.0.0; Python 3.10 is required starting 9.0.0.
fix
Use Python >=3.10. Update environment or use older parsedmarc version (<=8.x).
affects: 9.0.0+
gotchaWhen using parsedmarc with Elasticsearch, the index mapping must be created manually or via the CLI '--es-index' flag. If not created, parsedmarc will not write to Elasticsearch and may fail silently.
fix
Use the command-line option '--es-create-index' or set the environment variable PARSEDMARC_ES_CREATE_INDEX=true.
affects: all
gotchaGeoIP lookups require the GeoIP2 database file (GeoLite2-City.mmdb). If not present and geoip2 is installed, parsing will fail with FileNotFoundError.
fix
Set the environment variable PARSEDMARC_GEOIP_DB_PATH to the path of the MMDB file, or place the file in the default location.
affects: all
deprecatedThe function parse_report_email() is deprecated in favor of parse_report() since version 7.0.0.
fix
Use parse_report() instead. It accepts the same arguments.
affects: 7.0.0+
Errors
Common errors & fixes
AttributeError: 'str' object has no attribute 'decode'
Python 3 compatibility: bytes.decode() used, but string passed.
fix
Ensure 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.
fix
Upgrade 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.
fix
Uninstall 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.
fix
Use 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
Agent activity
42 hits · last 30 days
node
36
OpenAI (training)
2
Resources
parsedmarc — pip install parsedmarc · libregistry