PCQRSCANER/venv/Lib/site-packages/imapclient/examples/oauth2_example.py

22 lines
451 B
Python
Raw Normal View History

2019-12-22 21:51:47 +01:00
from __future__ import unicode_literals
from imapclient import IMAPClient
# Populate these with actual values
OAUTH2_USER = '...'
OAUTH2_ACCESS_TOKEN = '...'
HOST = 'imap.host.com'
URL = "https://somedomain.com/someuser/imap/"
ssl = True
server = IMAPClient(HOST, use_uid=True, ssl=ssl)
resp = server.oauth2_login(URL, OAUTH2_USER, OAUTH2_ACCESS_TOKEN)
print(resp)
select_info = server.select_folder('INBOX')
print(select_info)
server.logout()