File: oauth2_example.py

package info (click to toggle)
python-imapclient 3.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 644 kB
  • sloc: python: 5,341; sh: 14; makefile: 13
file content (14 lines) | stat: -rw-r--r-- 333 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# Login using OAUTH2

from imapclient import IMAPClient

# Populate these with actual values
OAUTH2_USER = "..."
OAUTH2_ACCESS_TOKEN = "..."

HOST = "imap.host.com"
URL = "https://somedomain.com/someuser/imap/"

with IMAPClient(HOST) as server:
    server.oauth2_login(URL, OAUTH2_USER, OAUTH2_ACCESS_TOKEN)
    # ...do something...