Not getting all results when using headers_only
See original GitHub issueHi,
I wanted to get a quick list of the uids of messages in a mailbox. Using:
msg_uids = [msg.uid for msg in mailbox.fetch()]
I get a list with the uids for all messages in the mailbox, in length equal to:
mailbox.folder.status()['MESSAGES']
But when I do the same with:
msg_uids = [msg.uid for msg in mailbox.fetch(headers_only=True)]
I only get to see a few of them…
I would expect either all uids to be returned or none at all, since the uid is not a part of the headers, right?
Similarly, something like:
for msg in mailbox.fetch(Q(uid=xxx),headers_only): print(msg.headers)
only works for the uids from the list returned by the previous command. Without the headers_only, it works for all the uids from that mailbox.
I have not yet looked into the imap_tools code, but I wanted to mention it here already anyway since this looks like strange behavior to me. At least, this is not what I would expect, and even if the usage seems strange (why would I need to use the uids when I can use Q to query), using the headers_only might perhaps also have other side-effects…
Best regards, Franky
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (6 by maintainers)
Top GitHub Comments
Hi Vladimir,
Thanks a lot! There’s been a lot in-between, but I will check the changes somewhere next week.
– Regards,
Franky
Van: Vladimir Kaukin notifications@github.com Beantwoorden - Aan: ikvk/imap_tools reply@reply.github.com Datum: vrijdag 28 augustus 2020 om 12:43 Aan: ikvk/imap_tools imap_tools@noreply.github.com CC: Franky Backeljauw franky.backeljauw@uantwerpen.be, Author author@noreply.github.com Onderwerp: Re: [ikvk/imap_tools] Not getting all results when using headers_only (#46)
fixed https://github.com/ikvk/imap_tools/releases/tag/v0.20.0https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fikvk%2Fimap_tools%2Freleases%2Ftag%2Fv0.20.0&data=02|01|franky.backeljauw%40uantwerpen.be|b5a885430f7240bb942e08d84b3f30c9|792e08fb2d544a8eaf72202548136ef6|0|0|637342082063326903&sdata=DMuubWfbKVaJtc013IwdSjQg5ckiBpa9bLnbKcJ6H20%3D&reserved=0. Thanks!
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fikvk%2Fimap_tools%2Fissues%2F46%23issuecomment-682457461&data=02|01|franky.backeljauw%40uantwerpen.be|b5a885430f7240bb942e08d84b3f30c9|792e08fb2d544a8eaf72202548136ef6|0|0|637342082063326903&sdata=hr178rWjWxNqTagfiTd3UnZiBsjNvk4a0eKo52MP5dE%3D&reserved=0, or unsubscribehttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FABJPBXL5YUVIXDCXLTAYHLDSC6C4VANCNFSM4OPX2YTA&data=02|01|franky.backeljauw%40uantwerpen.be|b5a885430f7240bb942e08d84b3f30c9|792e08fb2d544a8eaf72202548136ef6|0|0|637342082063336851&sdata=sNfzNPuQgClJFRbICkIc3jnJ6X%2FEyHfYjl2UfMkgPZ0%3D&reserved=0.
fixed https://github.com/ikvk/imap_tools/releases/tag/v0.20.0. Thanks!