I'm using Imap_tools library and I'm trying to fetch the emails in a folder 10 by 10 (for pagination and performance purposes) when I tried using limit and passing a tuple to it like so:
mails = mailbox.fetch(reverse = True, headers_only = True, mark_seen=False, limit=(10,20))
I got the following error
File "C:\Python39\lib\site-packages\imap_tools\mailbox.py", line 147, in fetch
assert type(limit_range) is slice
AssertionError
Is there anyone who has a solution or a better approach? I will be thankful!
Expected it to ignore the 1st 10 Emails and fetch the second 10 Emails!
Seems like the library is looking for a slice :
(10, 20)
=> slice(11, 21)
11th mail to 20th mail for a total of 10 mails, considering first mail's index is 1.