Very fast Python library for .eml files parsing.
Project description
fast_mail_parser
fast_mail_parser is a Python library for .eml files parsing. The main benefit is a performance: the library is much faster than python implementations.
Based on mailparse library using pyo3.
Benchmark
-------------------------------------------------------------------------------------------- benchmark: 2 tests -------------------------------------------------------------------------------------------
Name (time in ms) Min Max Mean StdDev Median IQR Outliers OPS Rounds Iterations
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
test__fast_mail_parser___parse_message 1.8136 (1.0) 1.8938 (1.0) 1.8426 (1.0) 0.0176 (1.0) 1.8465 (1.0) 0.0277 (1.0) 180;0 542.7141 (1.0) 450 1
test__mail_parser___parse_message 14.5583 (8.03) 15.8571 (8.37) 15.0264 (8.16) 0.2368 (13.49) 14.9702 (8.11) 0.2887 (10.42) 5;1 66.5495 (0.12) 32 1
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Legend:
Outliers: 1 Standard Deviation from Mean; 1.5 IQR (InterQuartile Range) from 1st Quartile and 3rd Quartile.
OPS: Operations Per Second, computed as 1 / Mean
Installation
Use the package manager pip to install fast_mail_parser.
pip install fast-mail-parser
Usage
import sys
from fast_mail_parser import parse_email, ParseError
with open('message.eml', 'r') as f:
message_payload = f.read()
try:
email = parse_email(message_payload)
except ParseError as e:
print("Failed to parse email: ", e)
sys.exit(1)
print(email.subject)
print(email.date)
print(email.text_plain)
print(email.text_html)
print(email.headers)
for attachment in email.attachments:
print(attachment.mimetype)
print(attachment.content)
print(attachment.filename)
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
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
fast_mail_parser-0.2.5.tar.gz
(413.8 kB
view hashes)
Built Distributions
Close
Hashes for fast_mail_parser-0.2.5-pp37-pypy37_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6735edc75b1089c90d90cbf58198c9dd439e912d3d257212738c4ca512e4bc58 |
|
MD5 | 1499f07f89640521ab5ef3204d5b6407 |
|
BLAKE2b-256 | d27aaf6b70d8366ba254deebcded52902dd007a76b5e87fe4990267b89e5da18 |
Close
Hashes for fast_mail_parser-0.2.5-cp310-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c6f1b80d53cad02c69c22de45ffc8a09b3e265d145aa0dfe2630d60fd4840807 |
|
MD5 | fdd5c778fdc168c137b26c2693772e80 |
|
BLAKE2b-256 | c9ecc957f009f10bbe938d880166f01359f8c3d8c9c447020dcbc2f33b8a05ab |
Close
Hashes for fast_mail_parser-0.2.5-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b29dae0fdbbb54300e15367a3789a180d6f98d64d772719b3c1df8f887be3514 |
|
MD5 | de800b89f8e522cbdea467ae9c0ddd1f |
|
BLAKE2b-256 | 8bad15d5af8197fd9a4443bf2b2d15b67e97a1bcfef9d3a666ed55285ce3a028 |
Close
Hashes for fast_mail_parser-0.2.5-cp310-cp310-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c315ec5cab222b8fe139643b5e69c4b10605b7beb6048eb70746427ee63e7bbb |
|
MD5 | bb2211446460ee6568e54e608262e2d6 |
|
BLAKE2b-256 | 9a215ec716bc9a7247cf904dc77bd2f8c8264a5e1fa702ad64ad8299cbbccb10 |
Close
Hashes for fast_mail_parser-0.2.5-cp39-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 93a5b2ff749dbee895c3cf4af22bebbb208dc508951ceab2c1a10ba81517adec |
|
MD5 | 4fb9224ad42ad8391dc5e1a90412599d |
|
BLAKE2b-256 | e648de5eb50b3e0dd5e0e783123e1bfea5143645e769d5a3671b8312865ebacd |
Close
Hashes for fast_mail_parser-0.2.5-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 984271d7bbc55d0177e1e48b40e796cf66636c894c0f43c673732cca9b60b3f0 |
|
MD5 | d1142ccc0ce2d19718ecd2f75bb28286 |
|
BLAKE2b-256 | 2da5302757a349c294616bc6e5f7395a6cd27638c15007a17500ef29e90b3019 |
Close
Hashes for fast_mail_parser-0.2.5-cp39-cp39-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6a6ac810e9947fd0cd8dc1e02b2aee782f7fa2f70e5e2cd39fdfb7bf2e7551e3 |
|
MD5 | 0be574f9237febd507425b5a4f31fcc5 |
|
BLAKE2b-256 | 9630572199480bc6f231ce946a016b4220febdf2ecc84af70cb322e4310e0224 |
Close
Hashes for fast_mail_parser-0.2.5-cp38-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d97bbb7de769e5cd7f9d1deb112c1077f5fe353e495c44e74e7d7c9b26505676 |
|
MD5 | ae0da42561ddc4fd93bf81e449962da9 |
|
BLAKE2b-256 | 8344d7474a5d2bf5551c7df4d6e247ca6980afa3c92dff030c4a3720a1962729 |
Close
Hashes for fast_mail_parser-0.2.5-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a0d1c0c7faa0d0c74b311f110a5aa1c4bb10ad8349f2c0845656e184e5944b3f |
|
MD5 | 752d6d6dd0e8ea30e811b2685de2bca0 |
|
BLAKE2b-256 | f4d0a8e9cdbab70fbaa17c536fa2f8a19291e02b299985539169109f5b601d74 |
Close
Hashes for fast_mail_parser-0.2.5-cp37-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6e94406c5ad25839ba197a295a5f9862716cd78dab885fc94d598c1338835893 |
|
MD5 | 4d4c8a42b8df5b0610c70672e30cb957 |
|
BLAKE2b-256 | 436dacc795f75022549b81179d136be6f4470520249f811bf15d0bb4d2056604 |
Close
Hashes for fast_mail_parser-0.2.5-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b51b5cd48c5007b950bf141ab0e914403967678c13fe7ca283ec5f4065e307f2 |
|
MD5 | d625c59409b578a83c76a09ec05424f3 |
|
BLAKE2b-256 | e923b39c625b8bf3a5b8525655d31b99da5fa4336e653a2696976054f0ff95ec |