forked from westonplatter/fast_arrow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
auth_mfa.py
33 lines (22 loc) · 929 Bytes
/
auth_mfa.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import configparser
from fast_arrow import Client
from fast_arrow.resources.user import User
print("----- running {}".format(__file__))
get the authentication configs
config_file = "config.debug.ini"
config = configparser.ConfigParser()
config.read(config_file)
username = config['account']['username']
password = config['account']['password']
mfa_code = "code goes here as a string"
client = Client(username=username, password=password, mfa_code=mfa_code)
result = client.authenticate()
print("Authenticated successfully = {}".format(result))
print("Account Url = {}".format(client.account_url))
print("Account Id = {}".format(client.account_id))
user = User.fetch(client)
print("Username = {}".format(user["username"]))
result = client.relogin_oauth2()
print("Re-Authenticated with refresh_token successfully = {}".format(result))
result = client.logout_oauth2()
print("Logged out successfully = {}".format(result))