mail-parser 4.1.3__tar.gz → 4.1.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {mail_parser-4.1.3/src/mail_parser.egg-info → mail_parser-4.1.4}/PKG-INFO +1 -1
- {mail_parser-4.1.3 → mail_parser-4.1.4/src/mail_parser.egg-info}/PKG-INFO +1 -1
- {mail_parser-4.1.3 → mail_parser-4.1.4}/src/mailparser/__main__.py +1 -1
- {mail_parser-4.1.3 → mail_parser-4.1.4}/src/mailparser/core.py +3 -5
- {mail_parser-4.1.3 → mail_parser-4.1.4}/src/mailparser/version.py +1 -1
- {mail_parser-4.1.3 → mail_parser-4.1.4}/tests/test_mail_parser.py +15 -0
- {mail_parser-4.1.3 → mail_parser-4.1.4}/LICENSE.txt +0 -0
- {mail_parser-4.1.3 → mail_parser-4.1.4}/NOTICE.txt +0 -0
- {mail_parser-4.1.3 → mail_parser-4.1.4}/README.md +0 -0
- {mail_parser-4.1.3 → mail_parser-4.1.4}/pyproject.toml +0 -0
- {mail_parser-4.1.3 → mail_parser-4.1.4}/setup.cfg +0 -0
- {mail_parser-4.1.3 → mail_parser-4.1.4}/setup.py +0 -0
- {mail_parser-4.1.3 → mail_parser-4.1.4}/src/mail_parser.egg-info/SOURCES.txt +0 -0
- {mail_parser-4.1.3 → mail_parser-4.1.4}/src/mail_parser.egg-info/dependency_links.txt +0 -0
- {mail_parser-4.1.3 → mail_parser-4.1.4}/src/mail_parser.egg-info/entry_points.txt +0 -0
- {mail_parser-4.1.3 → mail_parser-4.1.4}/src/mail_parser.egg-info/requires.txt +0 -0
- {mail_parser-4.1.3 → mail_parser-4.1.4}/src/mail_parser.egg-info/top_level.txt +0 -0
- {mail_parser-4.1.3 → mail_parser-4.1.4}/src/mailparser/__init__.py +0 -0
- {mail_parser-4.1.3 → mail_parser-4.1.4}/src/mailparser/const.py +0 -0
- {mail_parser-4.1.3 → mail_parser-4.1.4}/src/mailparser/exceptions.py +0 -0
- {mail_parser-4.1.3 → mail_parser-4.1.4}/src/mailparser/utils.py +0 -0
- {mail_parser-4.1.3 → mail_parser-4.1.4}/tests/test_main.py +0 -0
|
@@ -638,14 +638,12 @@ class MailParser(object):
|
|
|
638
638
|
)
|
|
639
639
|
|
|
640
640
|
@property
|
|
641
|
-
def headers(self):
|
|
641
|
+
def headers(self) -> dict:
|
|
642
642
|
"""
|
|
643
643
|
Return only the headers as Python object
|
|
644
644
|
"""
|
|
645
|
-
|
|
646
|
-
for i in
|
|
647
|
-
d[i] = getattr(self, i)
|
|
648
|
-
return d
|
|
645
|
+
all_headers = set(self.message.keys()) - set(["headers"])
|
|
646
|
+
return {i: getattr(self, i) for i in all_headers}
|
|
649
647
|
|
|
650
648
|
@property
|
|
651
649
|
def headers_json(self):
|
|
@@ -62,6 +62,7 @@ mail_test_12 = os.path.join(base_path, "mails", "mail_test_12")
|
|
|
62
62
|
mail_test_13 = os.path.join(base_path, "mails", "mail_test_13")
|
|
63
63
|
mail_test_14 = os.path.join(base_path, "mails", "mail_test_14")
|
|
64
64
|
mail_test_15 = os.path.join(base_path, "mails", "mail_test_15")
|
|
65
|
+
mail_test_16 = os.path.join(base_path, "mails", "mail_test_16")
|
|
65
66
|
mail_malformed_1 = os.path.join(base_path, "mails", "mail_malformed_1")
|
|
66
67
|
mail_malformed_2 = os.path.join(base_path, "mails", "mail_malformed_2")
|
|
67
68
|
mail_malformed_3 = os.path.join(base_path, "mails", "mail_malformed_3")
|
|
@@ -646,3 +647,17 @@ class TestMailParser(unittest.TestCase):
|
|
|
646
647
|
md5.update(f.read())
|
|
647
648
|
shutil.rmtree(temp_dir)
|
|
648
649
|
self.assertEqual(md5.hexdigest(), "4f2cf891e7cfb349fca812091f184ecc")
|
|
650
|
+
|
|
651
|
+
def test_issue_139(self):
|
|
652
|
+
mail = mailparser.parse_from_file(mail_test_16)
|
|
653
|
+
assert mail.headers == {
|
|
654
|
+
"MIME-Version": "1.0",
|
|
655
|
+
"Precedence": "junk",
|
|
656
|
+
"Content-Type": "text/plain; charset=us-ascii",
|
|
657
|
+
"From": [("Sender", "sender@example.net")],
|
|
658
|
+
"Date": "Wed, 23 Jul 2003 23:30:00 +0200",
|
|
659
|
+
"Content-Transfer-Encoding": "7bit",
|
|
660
|
+
"Message-ID": "<GTUBE1.1010101@example.net>",
|
|
661
|
+
"Subject": "Test spam mail (GTUBE)",
|
|
662
|
+
"To": [("Recipient", "recipient@example.net")],
|
|
663
|
+
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|