diff --git a/CHANGELOG.md b/CHANGELOG.md index 8581aab..686dd14 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ Changelog - Support non-standard, text-based forensic reports sent by some mail hosts - Set forensic report version to `None` (`null` in JSON) if the report was in a non-standard format and/or is missing a version number +- The default value of the `mailbox` `batch_size` option is now `10` (use `0` for no limit) 8.1.1 ----- diff --git a/README.rst b/README.rst index 20fda9d..7067ea0 100644 --- a/README.rst +++ b/README.rst @@ -203,7 +203,7 @@ The full set of configuration options are: - ``watch`` - bool: Use the IMAP ``IDLE`` command to process messages as they arrive or poll MS Graph for new messages - ``delete`` - bool: Delete messages after processing them, instead of archiving them - ``test`` - bool: Do not move or delete messages - - ``batch_size`` - int: Number of messages to read and process before saving. Defaults to all messages if not set. + - ``batch_size`` - int: Number of messages to read and process before saving. Default 10. Use 0 for no limit. - ``imap`` - ``host`` - str: The IMAP server hostname or IP address diff --git a/docs/index.rst b/docs/index.rst index 90f6e9b..be6995f 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -195,7 +195,7 @@ The full set of configuration options are: - ``watch`` - bool: Use the IMAP ``IDLE`` command to process messages as they arrive or poll MS Graph for new messages - ``delete`` - bool: Delete messages after processing them, instead of archiving them - ``test`` - bool: Do not move or delete messages - - ``batch_size`` - int: Number of messages to read and process before saving. Defaults to all messages if not set. + - ``batch_size`` - int: Number of messages to read and process before saving. Default 10. Use 0 for no limit. - ``imap`` - ``host`` - str: The IMAP server hostname or IP address diff --git a/parsedmarc/__init__.py b/parsedmarc/__init__.py index 6976e0b..c03794b 100644 --- a/parsedmarc/__init__.py +++ b/parsedmarc/__init__.py @@ -1034,7 +1034,7 @@ def get_dmarc_reports_from_mailbox(connection: MailboxConnection, dns_timeout=6.0, strip_attachment_payloads=False, results=None, - batch_size=None, + batch_size=10, create_folders=True): """ Fetches and parses DMARC reports from a mailbox @@ -1053,6 +1053,7 @@ def get_dmarc_reports_from_mailbox(connection: MailboxConnection, forensic report results results (dict): Results from the previous run batch_size (int): Number of messages to read and process before saving + (use 0 for no limit) create_folders (bool): Whether to create the destination folders (not used in watch) diff --git a/parsedmarc/cli.py b/parsedmarc/cli.py index 5722f57..35fa4c1 100644 --- a/parsedmarc/cli.py +++ b/parsedmarc/cli.py @@ -393,8 +393,6 @@ def _main(): opts.mailbox_test = mailbox_config.getboolean("test") if "batch_size" in mailbox_config: opts.mailbox_batch_size = mailbox_config.getint("batch_size") - else: - opts.mailbox_batch_size = None if "imap" in config.sections(): imap_config = config["imap"] @@ -467,8 +465,6 @@ def _main(): "configuration section has been deprecated. " "Use this option in the mailbox configuration " "section instead.") - else: - opts.mailbox_batch_size = None if "msgraph" in config.sections(): graph_config = config["msgraph"]