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.
Files changed (22) hide show
  1. {mail_parser-4.1.3/src/mail_parser.egg-info → mail_parser-4.1.4}/PKG-INFO +1 -1
  2. {mail_parser-4.1.3 → mail_parser-4.1.4/src/mail_parser.egg-info}/PKG-INFO +1 -1
  3. {mail_parser-4.1.3 → mail_parser-4.1.4}/src/mailparser/__main__.py +1 -1
  4. {mail_parser-4.1.3 → mail_parser-4.1.4}/src/mailparser/core.py +3 -5
  5. {mail_parser-4.1.3 → mail_parser-4.1.4}/src/mailparser/version.py +1 -1
  6. {mail_parser-4.1.3 → mail_parser-4.1.4}/tests/test_mail_parser.py +15 -0
  7. {mail_parser-4.1.3 → mail_parser-4.1.4}/LICENSE.txt +0 -0
  8. {mail_parser-4.1.3 → mail_parser-4.1.4}/NOTICE.txt +0 -0
  9. {mail_parser-4.1.3 → mail_parser-4.1.4}/README.md +0 -0
  10. {mail_parser-4.1.3 → mail_parser-4.1.4}/pyproject.toml +0 -0
  11. {mail_parser-4.1.3 → mail_parser-4.1.4}/setup.cfg +0 -0
  12. {mail_parser-4.1.3 → mail_parser-4.1.4}/setup.py +0 -0
  13. {mail_parser-4.1.3 → mail_parser-4.1.4}/src/mail_parser.egg-info/SOURCES.txt +0 -0
  14. {mail_parser-4.1.3 → mail_parser-4.1.4}/src/mail_parser.egg-info/dependency_links.txt +0 -0
  15. {mail_parser-4.1.3 → mail_parser-4.1.4}/src/mail_parser.egg-info/entry_points.txt +0 -0
  16. {mail_parser-4.1.3 → mail_parser-4.1.4}/src/mail_parser.egg-info/requires.txt +0 -0
  17. {mail_parser-4.1.3 → mail_parser-4.1.4}/src/mail_parser.egg-info/top_level.txt +0 -0
  18. {mail_parser-4.1.3 → mail_parser-4.1.4}/src/mailparser/__init__.py +0 -0
  19. {mail_parser-4.1.3 → mail_parser-4.1.4}/src/mailparser/const.py +0 -0
  20. {mail_parser-4.1.3 → mail_parser-4.1.4}/src/mailparser/exceptions.py +0 -0
  21. {mail_parser-4.1.3 → mail_parser-4.1.4}/src/mailparser/utils.py +0 -0
  22. {mail_parser-4.1.3 → mail_parser-4.1.4}/tests/test_main.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mail-parser
3
- Version: 4.1.3
3
+ Version: 4.1.4
4
4
  Summary: Improved wrapper for email standard library
5
5
  Home-page: https://github.com/SpamScope/mail-parser
6
6
  Author: Fedele Mantuano
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mail-parser
3
- Version: 4.1.3
3
+ Version: 4.1.4
4
4
  Summary: Improved wrapper for email standard library
5
5
  Home-page: https://github.com/SpamScope/mail-parser
6
6
  Author: Fedele Mantuano
@@ -202,7 +202,7 @@ def main():
202
202
  parser = get_parser(args)
203
203
  process_output(args, parser)
204
204
  except Exception as e:
205
- log.error(f"An error occurred: {e}")
205
+ log.exception(f"An error occurred: {e}")
206
206
  sys.exit(1)
207
207
 
208
208
 
@@ -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
- d = {}
646
- for i in self.message.keys():
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):
@@ -17,4 +17,4 @@ See the License for the specific language governing permissions and
17
17
  limitations under the License.
18
18
  """
19
19
 
20
- __version__ = "4.1.3"
20
+ __version__ = "4.1.4"
@@ -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