Fix error message

This commit is contained in:
Sean Whalen
2018-03-27 10:34:15 -04:00
parent eb05aaf709
commit 8a49aacd43
2 changed files with 9 additions and 8 deletions
+1
View File
@@ -1361,6 +1361,7 @@ def watch_inbox(host, username, password, callback, reports_folder="INBOX",
nameservers=ns,
dns_timeout=dt)
callback(res)
break
except imapclient.exceptions.IMAPClientError as error:
error = error.__str__().lstrip("b'").rstrip("'").rstrip(".")
+8 -8
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"])
begin_date_human = end_date.strftime("%Y-%m-%d %H:%M:%S")
begin_date_human = begin_date.strftime("%Y-%m-%d %H:%M:%S")
end_date_human = end_date.strftime("%Y-%m-%d %H:%M:%S")
aggregate_report["begin_date"] = begin_date
aggregate_report["end_date"] = end_date
@@ -214,12 +214,12 @@ def save_aggregate_report_to_elasticsearch(aggregate_report):
existing = search.execute()
if len(existing) > 0:
raise AlreadySaved("Aggregate report from {0} about {1} with date "
"range of {2} UTC to {3} UTC already exists in "
"Elasticsearch".format(org_name,
domain,
begin_date_human,
end_date_human))
raise AlreadySaved("An aggregate report from {0} about {1} with a "
"date range of {2} UTC to {3} UTC already exists "
"in Elasticsearch".format(org_name,
domain,
begin_date_human,
end_date_human))
published_policy = PublishedPolicy(
adkim=aggregate_report["policy_published"]["adkim"],
aspf=aggregate_report["policy_published"]["aspf"],
@@ -302,7 +302,7 @@ def save_forensic_report_to_elasticsearch(forensic_report):
existing = search.execute()
if len(existing) > 0:
raise AlreadySaved("A matching forensic sample to {0} from {1} "
raise AlreadySaved("A forensic sample to {0} from {1} "
"with a subject of {2} and arrival date of {3} "
"already exists in "
"Elasticsearch".format(headers["to"],