[New-bugs-announce] [issue11245] Implementation of IMAP IDLE in imaplib?

Shay Rojansky report at bugs.python.org
Fri Feb 18 21:36:11 CET 2011

New submission from Shay Rojansky <roji at roji.org>:

IMAP IDLE support is not implemented in the current imaplib. A "drop-in" replacement called imaplib2 exists (), but uses internally managed threads - a heavy solution that is not always appropriate (e.g. when handling many IMAP accounts an asynchronous approach would be more efficient)

I am about to start implementation of an asynchronous select()-compatible approach, and was wondering if there has been any discussion over IDLE, any specific reasons it hasn't been implemented and if eventual integration into imaplib would be a desirable thing.

Proposed approach:
* Addition of a new state 'IDLE'
* Addition of an idle() method to class IMAP4, which issues the IDLE command to the server and returns immediately. At this point we enter the IDLE state, in which no normal IMAP commands may be issued.
* Users can now select() or poll() the socket as they wish
* A method can be called to retrieve any untagged responses (e.g. EXISTS) that have arrived since entering the IDLE state. The function returns immediately and does not modify the state.
* To end the IDLE state, the user calls a method (done()?) which resumes the previous state.

Would appreciate any sort of feedback...

components: Library (Lib)
messages: 128814
nosy: Shay.Rojansky
priority: normal
severity: normal
status: open
title: Implementation of IMAP IDLE in imaplib?
type: feature request

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list