Created
January 10, 2019 06:07
-
-
Save timtan/ff05817fedea6d1b1284ca739d26c67e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asana | |
asana_personal_token = "" # Personal Token | |
project_id = 0 # Project id | |
client = asana.Client.access_token(asana_personal_token) | |
def cumpute_days(section): | |
days = 0 | |
for task in client.tasks.find_by_section(section): | |
task_id = task['id'] | |
task_deatil = client.tasks.find_by_id(task_id) | |
for field in task_deatil[u'custom_fields']: | |
if field['name'] == 'Days' and field['number_value']: | |
days +=field['number_value'] | |
return days | |
for section in client.sections.find_by_project(956418772713380): | |
name = section['name'] | |
section_id = section['id'] | |
print name | |
print cumpute_days(section_id) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
token can be get from here
https://app.asana.com/0/577043048663195/list
document
https://asana.com/developers/documentation/getting-started/quick-start