Skip to main content

gocept.imapapi

This package provides an object-oriented API for accessing IMAP servers. It was written to provide an API that is simple to use while still maintaining good performance.

About

gocept.imapapi is sponsored by the Technical University of Munich as part of a research co-operation geared towards an integrated webmail system for the university’s student portal MyTum. Other components of this project include gocept.restmail and CMFWebmail.

This project was initially developed by gocept gmbh & co. kg.

Object-oriented API

One of the first goals of the webmail project was to factor out the lower-level utilities to allow others to build on our efforts.

This library takes on to provide a better abstracted, more object-oriented, well, more pythonic approach than the builtin imaplib does.

Let us give you an example of what we feel a good API looks like:

>>> from gocept.imapapi import Account
>>> account = Account('localhost', 10143, 'tim', 'mightywizard')
>>> account.folders.keys()
['INBOX']
>>> account.folders['INBOX'].messages
<Messages object at 0x...>
>>> for message in account.folders['INBOX'].messages.values():
...     repr(message.headers['subject'])
u'Re: your spell from last week'
u'Enlarge your magic wand!'

Some of the aspects that come to mind when looking at this example:

  • Object model on top of protocol specifics

  • Use of native Python data structures

  • Decode protocol-specific data as early as possible (see the unicode headers)

With this approach we try to make programming IMAP clients simpler and more convenient.

Performance

The imapapi layer tries to keep the amount and size of communication as small as possible, only retrieving data when really needed and re-using data already retrieved.

As an examples, body content isn’t downloaded until needed and even when looking at the body structure we differentiate between metadata and content.

Status

This package is still in early development and published for experimental purposes and to invite a wider community to join us developing an IMAP library that is more convenient than Python’s builtin imaplib.

Running the tests

The tests expect an IMAP server to be available on localhost:10143. The default buildout environment provides a dovecot installation for this.

As we aim to be compatible with as many IMAP servers as possible, you should be able to provide any IMAP server on this port, as long as a user ‘test’ with the password ‘bsdf’ is configured.

Warning: Do not let the tests run against a production system. They might wreak havoc.

CHANGES

0.5 (2011-01-31)

  • Added Folder.unread_message_count.

  • Added some debug output to help with #6830 and #7769.

  • Made some recently introduced logging more useful, adapted tests.

0.4.1 (2010-11-30)

  • Made the test infrastructure load test messages in a more stable order.

0.4 (2010-09-24)

  • Added filter criterion “seen” (#7263).

0.3 (2010-08-09)

  • Filter messages on the IMAP server. (#4699)

0.2 (2010-08-04)

  • Lots of changes (see svn log for details).

0.1 (2008-07-22)

  • initial release.

Release files for gocept.imapapi 0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gocept.imapapi 0.5
File Size Uploaded
gocept.imapapi-0.5.tar.gz 527.3 kB Details

Release files / gocept.imapapi-0.5.tar.gz

Download URL gocept.imapapi-0.5.tar.gz
Size 527.3 kB
Tags Source
SHA-256 checksum
How to use checksums
4cf915a3b0a9080709026f1111a13af0b90713456227572fe99de94b4e58da23
BLAKE2b-256 checksum
How to use checksums
85f98bc99cb65ad6d3a86dea1df501731fcd266a574bb583aa13554ba7a76cbc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.5 This release

1 release file

0.4

1 release file

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page