From 32ae817a2a64a9c5e985a992ab4e170e94a95dd0 Mon Sep 17 00:00:00 2001 From: steffen123 Date: Thu, 15 Jul 2010 01:49:04 +0200 Subject: [PATCH] remove IMAPEmailFetcher as ImapSummaries has a superset of features --- pyfpdb/IMAPEmailFetcher.py | 61 -------------------------------------- 1 file changed, 61 deletions(-) delete mode 100644 pyfpdb/IMAPEmailFetcher.py diff --git a/pyfpdb/IMAPEmailFetcher.py b/pyfpdb/IMAPEmailFetcher.py deleted file mode 100644 index 840ccd2d..00000000 --- a/pyfpdb/IMAPEmailFetcher.py +++ /dev/null @@ -1,61 +0,0 @@ -import imaplib -import Configuration -import os -import pprint - -pp = pprint.PrettyPrinter(indent=4) - -def open_imap_connection(verbose=False): - # Read the config file - # FIXME - hostname = 'imap.gmail.com' - port = 993 - username = 'slartibartfast' - password = '42' - - # Connect - if verbose: print "Connecting to %s" % hostname - connection = imaplib.IMAP4_SSL(hostname) - - # Login to our account - if verbose: print "Logging in as %s" % username - connection.login(username, password) - return connection - -if __name__ == '__main__': - # Read the config file - # FIXME - folder = "INBOX" - c = open_imap_connection(verbose=True) - - try: - typ, data = c.list(directory=folder) - print typ, data - - c.select('INBOX', readonly=True) - - typ, msg_ids = c.search(None, '(SUBJECT "Results for PokerStars Tournament *")') - print typ, msg_ids - msgidlist = msg_ids[0].split(' ') - print msgidlist - - for msg in msgidlist: - print 'HEADER:' - typ, msg_data = c.fetch(msg, '(BODY.PEEK[HEADER])') - for response_part in msg_data: - if isinstance(response_part, tuple): - print response_part[1] - - print 'BODY TEXT:' - typ, msg_data = c.fetch(msg, '(BODY.PEEK[TEXT])') - for response_part in msg_data: - if isinstance(response_part, tuple): - print response_part[1] - - - finally: - try: - c.close() - except: - pass - c.logout()