import asana
import json
from six import print_
client = asana.Client.basic_auth('personal token')
me = client.users.me()
print_("me=" + json.dumps(me, indent=2))
personal_projects = next(workspace for workspace in me['workspaces'] if workspace['name'] == 'workspace name')
projects = client.projects.find_by_workspace(personal_projects['gid'], iterator_type=None)
print_("personal_projects=" + json.dumps(projects, indent=2))
for project in projects:
#print_ ("gid", project['gid'] )
if project["name"] == "Test": # name of the searched project
print_ ("")
print_ ("Project", project['name'] )
project_id = project['gid']
project_tasks = client.tasks.find_by_project(project_id, iterator_type=None)
for task in project_tasks:
#print_("Tasks=" + json.dumps(task, indent=2))
print_ (" Task ", task['gid'], ":", task['name'] )
task_id = task['gid']
task_subtasks = client.tasks.subtasks(task_id, full_payload=True)
for subtask in task_subtasks:
#print_(" Sub-tasks=" + json.dumps(subtask, indent=2))
print_ (subtask['gid'], ":", subtask['name'] )
In that project (Test) as a task there is an excel saved, I would like to be able to download that excel. Continuing with that code, I don't know if it's possible.
Thank you