diff options
| author | CoprDistGit <infra@openeuler.org> | 2023-04-11 07:26:56 +0000 |
|---|---|---|
| committer | CoprDistGit <infra@openeuler.org> | 2023-04-11 07:26:56 +0000 |
| commit | 1931651b16e5385ee5e2ef389635e4aed841c29c (patch) | |
| tree | 218e7c1d97cf0e7ec24ae86cffe94611116eda75 | |
| parent | 63af0ff98effa060b31e16a4c57661f16d24b2e8 (diff) | |
automatic import of python-eml-parser
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | python-eml-parser.spec | 495 | ||||
| -rw-r--r-- | sources | 1 |
3 files changed, 497 insertions, 0 deletions
@@ -0,0 +1 @@ +/eml_parser-1.17.5.tar.gz diff --git a/python-eml-parser.spec b/python-eml-parser.spec new file mode 100644 index 0000000..94eb173 --- /dev/null +++ b/python-eml-parser.spec @@ -0,0 +1,495 @@ +%global _empty_manifest_terminate_build 0 +Name: python-eml-parser +Version: 1.17.5 +Release: 1 +Summary: Python EML parser library +License: AGPLv3+ +URL: https://github.com/GOVCERT-LU/eml_parser +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/2a/df/74a8e9b2e45d411978cd414d9a6b420a51263846ddc633ebfb99e97c8417/eml_parser-1.17.5.tar.gz +BuildArch: noarch + +Requires: python3-dateutil +Requires: python3-charset-normalizer +Requires: python3-publicsuffixlist +Requires: python3-pylint +Requires: python3-mypy +Requires: python3-flake8 +Requires: python3-flake8-comprehensions +Requires: python3-flake8-docstrings +Requires: python3-pep8-naming +Requires: python3-types-python-dateutil +Requires: python3-types-chardet +Requires: python3-mkdocs-material +Requires: python3-mkdocstrings[crystal,python] +Requires: python3-file-magic +Requires: python3-pyre2 +Requires: python3-regex +Requires: python3-pytest +Requires: python3-coverage + +%description +[](https://codebeat.co/projects/github-com-govcert-lu-eml_parser-master) +[](https://travis-ci.com/GOVCERT-LU/eml_parser) +[](http://eml-parser.readthedocs.io) +[](https://badge.fury.io/py/eml-parser) +[](https://pypi.python.org/pypi/eml-parser/) + +eml_parser serves as a python module for parsing eml files and returning various +information found in the e-mail as well as computed information. + +Extracted and generated information include but are not limited to: +- attachments + - hashes + - names +- from, to, cc +- received servers path +- subject +- list of URLs parsed from the text content of the mail (including HTML body/attachments) + +Please feel free to send me your comments / pull requests. + +For the changelog, please see [CHANGELOG.md](CHANGELOG.md). + +### Installation: +```shell script +pip install eml_parser[filemagic] +``` + +:warning: **Note:** If you don't want to / cannot use file-magic (e.g. if you are using python-magic), install via: +```shell script +pip install eml_parser +``` + +### Known Issues +#### **OSX** users +Make sure to install libmagic, else eml_parser will not work. + +#### Python <=3.7.4 "rare header field parsing issue" +It has been reported (in #60) that there are parsing issues in some particular cases which seem +to be caused by a bug in the *email* module of the Python standard library. At least versions <=3.7.4 are affected. + +Python versions >=3.7.11 are not affected. If you do get *KeyError* exceptions on header field parsing, you should +consider upgrading to a more recent version of Python. + +-> Please open an issue if the error persists after upgrading. + + +### Example usage: +```python +import datetime +import json +import eml_parser + + +def json_serial(obj): + if isinstance(obj, datetime.datetime): + serial = obj.isoformat() + return serial + + +with open('sample.eml', 'rb') as fhdl: + raw_email = fhdl.read() + +ep = eml_parser.EmlParser() +parsed_eml = ep.decode_email_bytes(raw_email) + +print(json.dumps(parsed_eml, default=json_serial)) +``` + + +Which gives for a minimalistic EML file something like this: +```json + { + "body": [ + { + "content_header": { + "content-language": [ + "en-US" + ] + }, + "hash": "6c9f343bdb040e764843325fc5673b0f43a021bac9064075d285190d6509222d" + } + ], + "header": { + "received_src": null, + "from": "john.doe@example.com", + "to": [ + "test@example.com" + ], + "subject": "Sample EML", + "received_foremail": [ + "test@example.com" + ], + "date": "2013-04-26T11:15:47+00:00", + "header": { + "content-language": [ + "en-US" + ], + "received": [ + "from localhost\tby mta.example.com (Postfix) with ESMTPS id 6388F684168\tfor <test@example.com>; Fri, 26 Apr 2013 13:15:55 +0200" + ], + "to": [ + "test@example.com" + ], + "subject": [ + "Sample EML" + ], + "date": [ + "Fri, 26 Apr 2013 11:15:47 +0000" + ], + "message-id": [ + "<F96257F63EAEB94C890EA6CE1437145C013B01FA@example.com>" + ], + "from": [ + "John Doe <john.doe@example.com>" + ] + }, + "received_domain": [ + "mta.example.com" + ], + "received": [ + { + "with": "esmtps id 6388f684168", + "for": [ + "test@example.com" + ], + "by": [ + "mta.example.com" + ], + "date": "2013-04-26T13:15:55+02:00", + "src": "from localhost by mta.example.com (postfix) with esmtps id 6388f684168 for <test@example.com>; fri, 26 apr 2013 13:15:55 +0200" + } + ] + } + } +``` + + +%package -n python3-eml-parser +Summary: Python EML parser library +Provides: python-eml-parser +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-eml-parser +[](https://codebeat.co/projects/github-com-govcert-lu-eml_parser-master) +[](https://travis-ci.com/GOVCERT-LU/eml_parser) +[](http://eml-parser.readthedocs.io) +[](https://badge.fury.io/py/eml-parser) +[](https://pypi.python.org/pypi/eml-parser/) + +eml_parser serves as a python module for parsing eml files and returning various +information found in the e-mail as well as computed information. + +Extracted and generated information include but are not limited to: +- attachments + - hashes + - names +- from, to, cc +- received servers path +- subject +- list of URLs parsed from the text content of the mail (including HTML body/attachments) + +Please feel free to send me your comments / pull requests. + +For the changelog, please see [CHANGELOG.md](CHANGELOG.md). + +### Installation: +```shell script +pip install eml_parser[filemagic] +``` + +:warning: **Note:** If you don't want to / cannot use file-magic (e.g. if you are using python-magic), install via: +```shell script +pip install eml_parser +``` + +### Known Issues +#### **OSX** users +Make sure to install libmagic, else eml_parser will not work. + +#### Python <=3.7.4 "rare header field parsing issue" +It has been reported (in #60) that there are parsing issues in some particular cases which seem +to be caused by a bug in the *email* module of the Python standard library. At least versions <=3.7.4 are affected. + +Python versions >=3.7.11 are not affected. If you do get *KeyError* exceptions on header field parsing, you should +consider upgrading to a more recent version of Python. + +-> Please open an issue if the error persists after upgrading. + + +### Example usage: +```python +import datetime +import json +import eml_parser + + +def json_serial(obj): + if isinstance(obj, datetime.datetime): + serial = obj.isoformat() + return serial + + +with open('sample.eml', 'rb') as fhdl: + raw_email = fhdl.read() + +ep = eml_parser.EmlParser() +parsed_eml = ep.decode_email_bytes(raw_email) + +print(json.dumps(parsed_eml, default=json_serial)) +``` + + +Which gives for a minimalistic EML file something like this: +```json + { + "body": [ + { + "content_header": { + "content-language": [ + "en-US" + ] + }, + "hash": "6c9f343bdb040e764843325fc5673b0f43a021bac9064075d285190d6509222d" + } + ], + "header": { + "received_src": null, + "from": "john.doe@example.com", + "to": [ + "test@example.com" + ], + "subject": "Sample EML", + "received_foremail": [ + "test@example.com" + ], + "date": "2013-04-26T11:15:47+00:00", + "header": { + "content-language": [ + "en-US" + ], + "received": [ + "from localhost\tby mta.example.com (Postfix) with ESMTPS id 6388F684168\tfor <test@example.com>; Fri, 26 Apr 2013 13:15:55 +0200" + ], + "to": [ + "test@example.com" + ], + "subject": [ + "Sample EML" + ], + "date": [ + "Fri, 26 Apr 2013 11:15:47 +0000" + ], + "message-id": [ + "<F96257F63EAEB94C890EA6CE1437145C013B01FA@example.com>" + ], + "from": [ + "John Doe <john.doe@example.com>" + ] + }, + "received_domain": [ + "mta.example.com" + ], + "received": [ + { + "with": "esmtps id 6388f684168", + "for": [ + "test@example.com" + ], + "by": [ + "mta.example.com" + ], + "date": "2013-04-26T13:15:55+02:00", + "src": "from localhost by mta.example.com (postfix) with esmtps id 6388f684168 for <test@example.com>; fri, 26 apr 2013 13:15:55 +0200" + } + ] + } + } +``` + + +%package help +Summary: Development documents and examples for eml-parser +Provides: python3-eml-parser-doc +%description help +[](https://codebeat.co/projects/github-com-govcert-lu-eml_parser-master) +[](https://travis-ci.com/GOVCERT-LU/eml_parser) +[](http://eml-parser.readthedocs.io) +[](https://badge.fury.io/py/eml-parser) +[](https://pypi.python.org/pypi/eml-parser/) + +eml_parser serves as a python module for parsing eml files and returning various +information found in the e-mail as well as computed information. + +Extracted and generated information include but are not limited to: +- attachments + - hashes + - names +- from, to, cc +- received servers path +- subject +- list of URLs parsed from the text content of the mail (including HTML body/attachments) + +Please feel free to send me your comments / pull requests. + +For the changelog, please see [CHANGELOG.md](CHANGELOG.md). + +### Installation: +```shell script +pip install eml_parser[filemagic] +``` + +:warning: **Note:** If you don't want to / cannot use file-magic (e.g. if you are using python-magic), install via: +```shell script +pip install eml_parser +``` + +### Known Issues +#### **OSX** users +Make sure to install libmagic, else eml_parser will not work. + +#### Python <=3.7.4 "rare header field parsing issue" +It has been reported (in #60) that there are parsing issues in some particular cases which seem +to be caused by a bug in the *email* module of the Python standard library. At least versions <=3.7.4 are affected. + +Python versions >=3.7.11 are not affected. If you do get *KeyError* exceptions on header field parsing, you should +consider upgrading to a more recent version of Python. + +-> Please open an issue if the error persists after upgrading. + + +### Example usage: +```python +import datetime +import json +import eml_parser + + +def json_serial(obj): + if isinstance(obj, datetime.datetime): + serial = obj.isoformat() + return serial + + +with open('sample.eml', 'rb') as fhdl: + raw_email = fhdl.read() + +ep = eml_parser.EmlParser() +parsed_eml = ep.decode_email_bytes(raw_email) + +print(json.dumps(parsed_eml, default=json_serial)) +``` + + +Which gives for a minimalistic EML file something like this: +```json + { + "body": [ + { + "content_header": { + "content-language": [ + "en-US" + ] + }, + "hash": "6c9f343bdb040e764843325fc5673b0f43a021bac9064075d285190d6509222d" + } + ], + "header": { + "received_src": null, + "from": "john.doe@example.com", + "to": [ + "test@example.com" + ], + "subject": "Sample EML", + "received_foremail": [ + "test@example.com" + ], + "date": "2013-04-26T11:15:47+00:00", + "header": { + "content-language": [ + "en-US" + ], + "received": [ + "from localhost\tby mta.example.com (Postfix) with ESMTPS id 6388F684168\tfor <test@example.com>; Fri, 26 Apr 2013 13:15:55 +0200" + ], + "to": [ + "test@example.com" + ], + "subject": [ + "Sample EML" + ], + "date": [ + "Fri, 26 Apr 2013 11:15:47 +0000" + ], + "message-id": [ + "<F96257F63EAEB94C890EA6CE1437145C013B01FA@example.com>" + ], + "from": [ + "John Doe <john.doe@example.com>" + ] + }, + "received_domain": [ + "mta.example.com" + ], + "received": [ + { + "with": "esmtps id 6388f684168", + "for": [ + "test@example.com" + ], + "by": [ + "mta.example.com" + ], + "date": "2013-04-26T13:15:55+02:00", + "src": "from localhost by mta.example.com (postfix) with esmtps id 6388f684168 for <test@example.com>; fri, 26 apr 2013 13:15:55 +0200" + } + ] + } + } +``` + + +%prep +%autosetup -n eml-parser-1.17.5 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-eml-parser -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Tue Apr 11 2023 Python_Bot <Python_Bot@openeuler.org> - 1.17.5-1 +- Package Spec generated @@ -0,0 +1 @@ +a28d7d6cfa405046d6814ef7167ccf7a eml_parser-1.17.5.tar.gz |
