mailbox.Mailbox.popitem()

popitem() Return an arbitrary (key, message) pair, where key is a key and message is a message representation, and delete the corresponding message. If the mailbox is empty, raise a KeyError exception. The message is represented as an instance of the appropriate format-specific Message subclass unless a custom message factory was specified when the Mailbox instance was initialized.

mailbox.Mailbox.pop()

pop(key, default=None) Return a representation of the message corresponding to key and delete the message. If no such message exists, return default. The message is represented as an instance of the appropriate format-specific Message subclass unless a custom message factory was specified when the Mailbox instance was initialized.

mailbox.Mailbox.lock()

lock() Acquire an exclusive advisory lock on the mailbox so that other processes know not to modify it. An ExternalClashError is raised if the lock is not available. The particular locking mechanisms used depend upon the mailbox format. You should always lock the mailbox before making any modifications to its contents.

mailbox.Mailbox.keys()

keys() Return an iterator over all keys if called as iterkeys() or return a list of keys if called as keys().

mailbox.Mailbox.itervalues()

itervalues() __iter__() values() Return an iterator over representations of all messages if called as itervalues() or __iter__() or return a list of such representations if called as values(). The messages are represented as instances of the appropriate format-specific Message subclass unless a custom message factory was specified when the Mailbox instance was initialized. Note The behavior of __iter__() is unlike that of dictionaries, which iterate over keys.

mailbox.Mailbox.iterkeys()

iterkeys() keys() Return an iterator over all keys if called as iterkeys() or return a list of keys if called as keys().

mailbox.Mailbox.iteritems()

iteritems() items() Return an iterator over (key, message) pairs, where key is a key and message is a message representation, if called as iteritems() or return a list of such pairs if called as items(). The messages are represented as instances of the appropriate format-specific Message subclass unless a custom message factory was specified when the Mailbox instance was initialized.

mailbox.Mailbox.items()

items() Return an iterator over (key, message) pairs, where key is a key and message is a message representation, if called as iteritems() or return a list of such pairs if called as items(). The messages are represented as instances of the appropriate format-specific Message subclass unless a custom message factory was specified when the Mailbox instance was initialized.

mailbox.Mailbox.get_string()

get_string(key) Return a string representation of the message corresponding to key, or raise a KeyError exception if no such message exists. The message is processed through email.message.Message to convert it to a 7bit clean representation.

mailbox.Mailbox.get_message()

get_message(key) Return a representation of the message corresponding to key as an instance of the appropriate format-specific Message subclass, or raise a KeyError exception if no such message exists.