This commit is contained in:
Sean Whalen
2018-03-27 06:24:26 -04:00
parent aeb16b5f73
commit 35adcb63ca
3 changed files with 10 additions and 5 deletions
+5
View File
@@ -1,3 +1,8 @@
3.2.1
-----
- Fix error saving to Elasticsearch
3.2.0
-----
- Fix existing aggregate report error message
+4 -4
View File
@@ -41,7 +41,7 @@ import imapclient.exceptions
import dateparser
import mailparser
__version__ = "3.2.0"
__version__ = "3.2.1"
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
@@ -183,7 +183,7 @@ def _timestamp_to_datetime(timestamp):
return datetime.fromtimestamp(int(timestamp))
def timestamp_to_human(timestamp):
def _timestamp_to_human(timestamp):
"""
Converts a UNIX/DMARC timestamp to a human-readable string
@@ -429,8 +429,8 @@ def parse_aggregate_report_xml(xml, nameservers=None, timeout=6.0):
"").replace(">", "").split("@")[0]
new_report_metadata["report_id"] = report_id
date_range = report["report_metadata"]["date_range"]
date_range["begin"] = timestamp_to_human(date_range["begin"])
date_range["end"] = timestamp_to_human(date_range["end"])
date_range["begin"] = _timestamp_to_human(date_range["begin"])
date_range["end"] = _timestamp_to_human(date_range["end"])
new_report_metadata["begin_date"] = date_range["begin"]
new_report_metadata["end_date"] = date_range["end"]
errors = []
+1 -1
View File
@@ -196,7 +196,7 @@ def save_aggregate_report_to_elasticsearch(aggregate_report):
domain = aggregate_report["policy_published"]["domain"]
begin_date = parsedmarc.human_timestamp_to_datetime(metadata["begin_date"])
end_date = parsedmarc.human_timestamp_to_datetime(metadata["end_date"])
end_date_human = parsedmarc.timestamp_to_human(end_date)
end_date_human = end_date.strftime("%Y-%m-%d %H:%M:%S")
aggregate_report["begin_date"] = begin_date
aggregate_report["end_date"] = end_date
date_range = (aggregate_report["begin_date"],