Add some APIs around subtask
still not finished
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import configparser
|
||||
import copy
|
||||
import logging
|
||||
from pprint import pprint
|
||||
|
||||
@@ -11,7 +12,6 @@ from ActiveCollabAPI.ACTokenAuthenticator import ACTokenAuthenticator
|
||||
# the only thing missing will be the response.body which is not logged.
|
||||
from http.client import HTTPConnection
|
||||
|
||||
|
||||
HTTPConnection.debuglevel = 1
|
||||
|
||||
logging.basicConfig() # you need to initialize logging, otherwise you will not see anything from requests
|
||||
@@ -31,7 +31,7 @@ if __name__ == "__main__":
|
||||
# 1. you need to login to get a session and a list of accounts
|
||||
auth = ACAuthenticator()
|
||||
session = auth.login(username, password)
|
||||
pprint(session)
|
||||
# pprint(session)
|
||||
user = session['user']
|
||||
# use first account
|
||||
account = auth.find_account(account_name)
|
||||
@@ -42,8 +42,46 @@ if __name__ == "__main__":
|
||||
|
||||
# 3. now you can query the API
|
||||
ac = ACClient(account, token)
|
||||
res = ac.get_projects()
|
||||
pprint(res.json())
|
||||
|
||||
res = ac.get_info()
|
||||
pprint(res.json())
|
||||
# get a list of all projects
|
||||
# res = ac.get_projects()
|
||||
# pprint(res.json())
|
||||
|
||||
# get task with sub tasks
|
||||
# https://app.activecollab.com/416910/projects/310/tasks/6274
|
||||
project_id = 310
|
||||
task_id = 6274
|
||||
task_res = ac.get_project_task(project_id, task_id)
|
||||
pprint(task_res.json())
|
||||
task = task_res.json()
|
||||
# res = ac.unassign_all_sub_task(task)
|
||||
|
||||
# create a new subtask for the task without assignment
|
||||
# subtask = {
|
||||
# "task_id": task_id,
|
||||
# "project_id": project_id,
|
||||
# "assignee_id": "",
|
||||
# "body": "test qqq"
|
||||
# }
|
||||
# res = ac.create_subtask(subtask)
|
||||
# pprint(res.json())
|
||||
|
||||
# # unassign a single subtask
|
||||
# subtask_id = 12203
|
||||
# subtask_res = ac.get_project_task_subtask(project_id, task_id, subtask_id)
|
||||
# # pprint(subtask_res.json())
|
||||
# subtask = subtask_res.json()['single']
|
||||
# res = ac.unassign_sub_task(subtask)
|
||||
# pprint(res.json())
|
||||
|
||||
# delete a subtask
|
||||
# subtask = {
|
||||
# "task_id": task_id,
|
||||
# "project_id": project_id,
|
||||
# "id": 13764
|
||||
# }
|
||||
# res = ac.delete_subtask(subtask)
|
||||
# pprint(res.json())
|
||||
|
||||
# res = ac.get_info()
|
||||
# pprint(res.json())
|
||||
|
||||
Reference in New Issue
Block a user