diff --git a/parsedmarc/utils.py b/parsedmarc/utils.py index 1c44ba3..724d7d6 100644 --- a/parsedmarc/utils.py +++ b/parsedmarc/utils.py @@ -176,6 +176,7 @@ def human_timestamp_to_datetime(human_timestamp): Returns: DateTime: The converted timestamp """ + human_timestamp = human_timestamp.replace("T", " ") return datetime.strptime(human_timestamp, "%Y-%m-%d %H:%M:%S") @@ -189,6 +190,7 @@ def human_timestamp_to_timestamp(human_timestamp): Returns: float: The converted timestamp """ + human_timestamp = human_timestamp.replace("T", " ") return human_timestamp_to_datetime(human_timestamp).timestamp() @@ -390,8 +392,6 @@ def parse_email(data): headers = json.loads(parsed_email.headers_json).copy() parsed_email = json.loads(parsed_email.mail_json).copy() parsed_email["headers"] = headers - if "date" in headers: - parsed_email["date"] = headers["date"].replace("T", " ") if "received" in parsed_email: for received in parsed_email["received"]: if "date_utc" in received: diff --git a/requirements.txt b/requirements.txt index 6d978e4..2c7c352 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,7 +6,7 @@ xmltodict geoip2 dnspython imapclient -mail-parser +mail-parser==3.5.1 dateparser elasticsearch>=6.3.0,<7.0.0 elasticsearch-dsl>=6.2.1,<7.0.0 diff --git a/setup.py b/setup.py index 4d848f7..60573cc 100644 --- a/setup.py +++ b/setup.py @@ -93,8 +93,9 @@ setup( # requirements files see: # https://packaging.python.org/en/latest/requirements.html install_requires=['dnspython', 'publicsuffix', 'xmltodict', 'geoip2', - 'urllib3', 'requests', 'imapclient', 'mail-parser', - 'dateparser', 'elasticsearch>=6.3.0,<7.0.0', + 'urllib3', 'requests', 'imapclient', + 'mail-parser==3.5.1', 'dateparser', + 'elasticsearch>=6.3.0,<7.0.0', 'elasticsearch-dsl>=6.2.1,<7.0.0', 'kafka-python' ],