diff --git a/CHANGELOG.md b/CHANGELOG.md index 9f5cc88..051c480 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +6.6.0 +----- + +- Set a configurable default IMAP timeout of 30 seconds +- Set a configurable maximum of 4 IMAP timeout retry attempts +- Add support for reading ``MBOX`` files +- Set a configurable elasticsearch timeout of 60 seconds + 6.5.5 ----- diff --git a/parsedmarc/__init__.py b/parsedmarc/__init__.py index 4a3dc03..b9018e0 100644 --- a/parsedmarc/__init__.py +++ b/parsedmarc/__init__.py @@ -19,6 +19,7 @@ import binascii import email import tempfile import email.utils +import mailbox import mailparser from expiringdict import ExpiringDict @@ -31,7 +32,7 @@ from parsedmarc.utils import is_outlook_msg, convert_outlook_msg from parsedmarc.utils import timestamp_to_human, human_timestamp_to_datetime from parsedmarc.utils import parse_email -__version__ = "6.5.4" +__version__ = "6.6.0" logging.basicConfig( format='%(levelname)8s:%(filename)s:%(lineno)d:' @@ -914,7 +915,6 @@ def get_dmarc_reports_from_mbox(input_, nameservers=None, dns_timeout=2.0, OrderedDict: Lists of ``aggregate_reports`` and ``forensic_reports`` """ - import mailbox aggregate_reports = [] forensic_reports = [] try: diff --git a/parsedmarc/elastic.py b/parsedmarc/elastic.py index ebc642a..72761a0 100644 --- a/parsedmarc/elastic.py +++ b/parsedmarc/elastic.py @@ -169,7 +169,7 @@ class AlreadySaved(ValueError): """Raised when a report to be saved matches an existing report""" -def set_hosts(hosts, use_ssl=False, ssl_cert_path=None): +def set_hosts(hosts, use_ssl=False, ssl_cert_path=None, timeout=60.0): """ Sets the Elasticsearch hosts to use @@ -177,12 +177,13 @@ def set_hosts(hosts, use_ssl=False, ssl_cert_path=None): hosts (str): A single hostname or URL, or list of hostnames or URLs use_ssl (bool): Use a HTTPS connection to the server ssl_cert_path (str): Path to the certificate chain + timeout (float): Timeout in seconds """ if type(hosts) != list: hosts = [hosts] conn_params = { "hosts": hosts, - "timeout": 20 + "timeout": timeout } if use_ssl: conn_params['use_ssl'] = True diff --git a/setup.py b/setup.py index bec6b75..ab2f217 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ from setuptools import setup from codecs import open from os import path -__version__ = "6.5.5" +__version__ = "6.6.0" description = "A Python package and CLI for parsing aggregate and " \ "forensic DMARC reports"