mail-parser 4.1.2__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.2/src/mail_parser.egg-info → mail_parser-4.1.4}/PKG-INFO +4 -5
  2. {mail_parser-4.1.2 → mail_parser-4.1.4}/setup.cfg +1 -3
  3. {mail_parser-4.1.2 → mail_parser-4.1.4/src/mail_parser.egg-info}/PKG-INFO +4 -5
  4. {mail_parser-4.1.2 → mail_parser-4.1.4}/src/mail_parser.egg-info/requires.txt +0 -1
  5. {mail_parser-4.1.2 → mail_parser-4.1.4}/src/mailparser/__main__.py +1 -1
  6. {mail_parser-4.1.2 → mail_parser-4.1.4}/src/mailparser/core.py +4 -6
  7. {mail_parser-4.1.2 → mail_parser-4.1.4}/src/mailparser/version.py +1 -1
  8. {mail_parser-4.1.2 → mail_parser-4.1.4}/tests/test_mail_parser.py +15 -0
  9. {mail_parser-4.1.2 → mail_parser-4.1.4}/LICENSE.txt +0 -0
  10. {mail_parser-4.1.2 → mail_parser-4.1.4}/NOTICE.txt +0 -0
  11. {mail_parser-4.1.2 → mail_parser-4.1.4}/README.md +0 -0
  12. {mail_parser-4.1.2 → mail_parser-4.1.4}/pyproject.toml +0 -0
  13. {mail_parser-4.1.2 → mail_parser-4.1.4}/setup.py +0 -0
  14. {mail_parser-4.1.2 → mail_parser-4.1.4}/src/mail_parser.egg-info/SOURCES.txt +0 -0
  15. {mail_parser-4.1.2 → mail_parser-4.1.4}/src/mail_parser.egg-info/dependency_links.txt +0 -0
  16. {mail_parser-4.1.2 → mail_parser-4.1.4}/src/mail_parser.egg-info/entry_points.txt +0 -0
  17. {mail_parser-4.1.2 → mail_parser-4.1.4}/src/mail_parser.egg-info/top_level.txt +0 -0
  18. {mail_parser-4.1.2 → mail_parser-4.1.4}/src/mailparser/__init__.py +0 -0
  19. {mail_parser-4.1.2 → mail_parser-4.1.4}/src/mailparser/const.py +0 -0
  20. {mail_parser-4.1.2 → mail_parser-4.1.4}/src/mailparser/exceptions.py +0 -0
  21. {mail_parser-4.1.2 → mail_parser-4.1.4}/src/mailparser/utils.py +0 -0
  22. {mail_parser-4.1.2 → mail_parser-4.1.4}/tests/test_main.py +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: mail-parser
3
- Version: 4.1.2
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
@@ -15,15 +15,13 @@ Classifier: Operating System :: OS Independent
15
15
  Classifier: Natural Language :: English
16
16
  Classifier: Programming Language :: Python
17
17
  Classifier: Programming Language :: Python :: 3
18
- Classifier: Programming Language :: Python :: 3.7
19
18
  Classifier: Programming Language :: Python :: 3.8
20
19
  Classifier: Programming Language :: Python :: 3.9
21
20
  Classifier: Programming Language :: Python :: 3.10
22
- Requires-Python: >=3.7
21
+ Requires-Python: >=3.8
23
22
  Description-Content-Type: text/markdown
24
23
  License-File: LICENSE.txt
25
24
  License-File: NOTICE.txt
26
- Requires-Dist: ipaddress
27
25
  Requires-Dist: six
28
26
  Provides-Extra: dev
29
27
  Requires-Dist: build; extra == "dev"
@@ -36,6 +34,7 @@ Requires-Dist: pytest; extra == "test"
36
34
  Requires-Dist: pytest-cov; extra == "test"
37
35
  Requires-Dist: pytest-mock; extra == "test"
38
36
  Requires-Dist: pytest-ordering; extra == "test"
37
+ Dynamic: license-file
39
38
 
40
39
  [![PyPI - Version](https://img.shields.io/pypi/v/mail-parser)](https://pypi.org/project/mail-parser/)
41
40
  [![Coverage Status](https://coveralls.io/repos/github/SpamScope/mail-parser/badge.svg?branch=develop)](https://coveralls.io/github/SpamScope/mail-parser?branch=develop)
@@ -18,7 +18,6 @@ classifiers =
18
18
  Natural Language :: English
19
19
  Programming Language :: Python
20
20
  Programming Language :: Python :: 3
21
- Programming Language :: Python :: 3.7
22
21
  Programming Language :: Python :: 3.8
23
22
  Programming Language :: Python :: 3.9
24
23
  Programming Language :: Python :: 3.10
@@ -28,9 +27,8 @@ package_dir =
28
27
  =src
29
28
  packages = find:
30
29
  install_requires =
31
- ipaddress
32
30
  six
33
- python_requires = >=3.7
31
+ python_requires = >=3.8
34
32
 
35
33
  [options.packages.find]
36
34
  where = src
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: mail-parser
3
- Version: 4.1.2
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
@@ -15,15 +15,13 @@ Classifier: Operating System :: OS Independent
15
15
  Classifier: Natural Language :: English
16
16
  Classifier: Programming Language :: Python
17
17
  Classifier: Programming Language :: Python :: 3
18
- Classifier: Programming Language :: Python :: 3.7
19
18
  Classifier: Programming Language :: Python :: 3.8
20
19
  Classifier: Programming Language :: Python :: 3.9
21
20
  Classifier: Programming Language :: Python :: 3.10
22
- Requires-Python: >=3.7
21
+ Requires-Python: >=3.8
23
22
  Description-Content-Type: text/markdown
24
23
  License-File: LICENSE.txt
25
24
  License-File: NOTICE.txt
26
- Requires-Dist: ipaddress
27
25
  Requires-Dist: six
28
26
  Provides-Extra: dev
29
27
  Requires-Dist: build; extra == "dev"
@@ -36,6 +34,7 @@ Requires-Dist: pytest; extra == "test"
36
34
  Requires-Dist: pytest-cov; extra == "test"
37
35
  Requires-Dist: pytest-mock; extra == "test"
38
36
  Requires-Dist: pytest-ordering; extra == "test"
37
+ Dynamic: license-file
39
38
 
40
39
  [![PyPI - Version](https://img.shields.io/pypi/v/mail-parser)](https://pypi.org/project/mail-parser/)
41
40
  [![Coverage Status](https://coveralls.io/repos/github/SpamScope/mail-parser/badge.svg?branch=develop)](https://coveralls.io/github/SpamScope/mail-parser?branch=develop)
@@ -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
 
@@ -355,7 +355,7 @@ class MailParser(object):
355
355
  charset = p.get_content_charset("utf-8")
356
356
  charset_raw = p.get_content_charset()
357
357
  log.debug("Charset {!r} part {!r}".format(charset, i))
358
- content_disposition = ported_string(p.get("content-disposition"))
358
+ content_disposition = ported_string(p.get_content_disposition()).lower()
359
359
  log.debug(
360
360
  "content-disposition {!r} part {!r}".format(content_disposition, i)
361
361
  )
@@ -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.2"
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