Skip to content

Instantly share code, notes, and snippets.

@icaoberg
Created May 12, 2023 15:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save icaoberg/e0ac4897f92286f60dcf87d970295003 to your computer and use it in GitHub Desktop.
Save icaoberg/e0ac4897f92286f60dcf87d970295003 to your computer and use it in GitHub Desktop.
Top 10 Asana Tasks
import os
import asana
from pathlib import Path
from tqdm import tqdm
import pandas as pd
import warnings
warnings.filterwarnings("ignore")
# @icaoberg Read secrets. assumes file exists in ~/.ASANA_SECRETS
# get personal access token here https://developers.asana.com/docs/personal-access-token
file = str(Path.home()) + os.sep + '.ASANA_SECRETS'
exec(open(file).read())
client = asana.Client.access_token(PERSONAL_ACCESS_TOKEN)
client.options['client_name'] = 'Jupyter Lab'
me = client.users.get_user("me")
workspaces = me['workspaces']
tasks = client.tasks.find_all(workspace=workspaces[1]['gid'], assignee='icaoberg@psc.edu')
todo = []
for task in tqdm(tasks):
tid = task['gid']
tmetadata = client.tasks.find_by_id(task=tid)
todo.append({'due_on':tmetadata['due_on'], \
'completed':tmetadata['completed'], \
'description':tmetadata['name']})
df = pd.DataFrame(todo)
print('\n# Top 10 Asana Tasks')
df = df[df['completed']==False].sort_values('due_on')
print(df[0:11][['due_on','description']].to_markdown(index=False,tablefmt="github"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment