def test_imap_old(user):
storage = Storage('credentials_file')
credentials = storage.get()
xoauth = xoauth2_str(user, credentials.access_token)
conn = imaplib.IMAP4_SSL('imap.googlemail.com')
conn.debug = 4
conn.authenticate('XOAUTH2', lambda x: xoauth)
status, labels = conn.list()
conn.select("[Gmail]/All Mail")
# Once authenticated everything from the impalib.IMAP4_SSL class will
# work as per usual without any modification to your code.
typ, msgnums = conn.search(None, 'X-GM-RAW', 'vget')
print 'typ', typ
print 'num', msgnums
# conn.select('INBOX')
# print conn.list()
评论列表
文章目录