Reorg code and tests
DON'T use main.py
This commit is contained in:
@@ -12,6 +12,8 @@ from ActiveCollabAPI.ACTokenAuthenticator import ACTokenAuthenticator
|
||||
# the only thing missing will be the response.body which is not logged.
|
||||
from http.client import HTTPConnection
|
||||
|
||||
from ActiveCollabAPI.ActiveCollab import ActiveCollab
|
||||
|
||||
HTTPConnection.debuglevel = 1
|
||||
|
||||
logging.basicConfig() # you need to initialize logging, otherwise you will not see anything from requests
|
||||
@@ -30,10 +32,10 @@ def main():
|
||||
account_name = config['LOGIN']['account_name']
|
||||
|
||||
# 1. you need to log in to get a session and a list of accounts
|
||||
auth = ACAuthenticator(AC_LOGIN_BASE_URL)
|
||||
auth.login_with_check(username, password)
|
||||
# use first account
|
||||
account = auth.find_account(account_name)
|
||||
ac = ActiveCollab(AC_LOGIN_BASE_URL)
|
||||
session = ac.login(username, password)
|
||||
account = ac.get_account(session) # default returning first account
|
||||
token = ac.get_token(account, session.user)
|
||||
|
||||
# 2. you need to get a token for this account
|
||||
token = ACTokenAuthenticator(account, auth.user).issue_token_intent()
|
||||
|
||||
Reference in New Issue
Block a user