Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added 'since' option to search for messages since a certain time #527

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ramspoluri
Copy link

  • Added since option under mailbox section to search for messages since a certain time instead of going through the complete mailbox during testing scenarios. Acceptable values -5m|3h|2d|1w, units - {"m":"minutes", "h":"hours", "d":"days", "w":"weeks"}). Defaults to 1d if an incorrect value is provided.
  • Not to mark messages as read if test option is selected (works only for MSGraphConnection)

    - Added `since` option under `mailbox` section to search for messages since a certain time instead of going through the complete mailbox during testing scenarios. Acceptable values -`5m|3h|2d|1w`, units - {"m":"minutes", "h":"hours", "d":"days", "w":"weeks"}). Defaults to `1d` if an incorrect value is provided.
    - Not to mark messages as read if test option is selected (works only for MSGraphConnection)
Copy link

codecov bot commented May 28, 2024

Codecov Report

Attention: Patch coverage is 8.77193% with 52 lines in your changes are missing coverage. Please review.

Project coverage is 58.39%. Comparing base (d6128ea) to head (f618f69).
Report is 22 commits behind head on master.

Files Patch % Lines
parsedmarc/__init__.py 5.88% 32 Missing ⚠️
parsedmarc/mail/graph.py 18.18% 9 Missing ⚠️
parsedmarc/mail/gmail.py 12.50% 7 Missing ⚠️
parsedmarc/mail/imap.py 0.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #527      +/-   ##
==========================================
- Coverage   59.88%   58.39%   -1.50%     
==========================================
  Files          12       12              
  Lines        1578     1620      +42     
==========================================
+ Hits          945      946       +1     
- Misses        633      674      +41     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

messages = connection.fetch_messages(reports_folder, batch_size=batch_size)
if since:
_since = 1440 # default one day
if re.match(r'\d{1,2}[mhd]$', since):
Copy link
Contributor

@AnaelMobilia AnaelMobilia Jun 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why restrict to two digits ? (eg: 365 days)
I suggest to use \d+ as the next regex

Ignoring option, fetching messages for last 24hrs"
.format(since))

if isinstance(connection, IMAPConnection):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add a reference to RFC3501 in order to indicate that the restriction (no time, no timezone) is on the SMTP protocol

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants