DEV Community

Cover image for Asana Automatization with Python.
Juan Antonio
Juan Antonio

Posted on

Asana Automatization with Python.

Asana is an awesome tool for handling your projects. Within this tool you'll find Workspaces, Projects, Sections and Tasks.

Asana

There are multiple ways for sorting your tasks and projects in Asana. My main setting is having several projects that contains multiple tasks, and finally a global project called Weekly Tasks where I'm able to see, just with a glance, all the tasks of the current week. Easy and simple.

Weekly Tasks View

This way of organization has allowed me managing better my team schedule at job and my own personal life, where multiple tasks from multiple projects and side-projects might gather.

A Weekly View allows you to have the control of your week and therefore your time.

Of course it's an interesting topic how to organise projects effectively but this is a discussion for another post. The main problem here is that I spent a lot of time cleaning and organising the Weekly View Project every day, so instead of continuing throughout this boring routine, I automatized the task.


Useful things before showing you the whole code:

  • I have used Python (latest version) and the Asana Python Library
  • You have to connect first to the Asana API using your API_KEY. Check here about how to get it. My recommendation is writting an external json file (adding it to the .gitignore file) with the API_KEY and others important keys instead of hard-coding it inside the main script.

Asana - Connecting to the API.

  • After that, you have to gather all the tasks that are attached to you or your team and iterate through those tasks.

  • Each task has attached a gid . This is the ID of each task. Everything in the API works with ids. You can see those IDs (for workspaces, projects, sections and even tasks) in the Asana URL when you tap inside each element.

  • You have to associate each task, using the gid to the project and section that you want to relate. Disclaimer: Afaik, every task should have associate a due date if you want to run successfully the script.

Here the whole script.

Script

Finally, the only thing that you have to do is to automatize it using a crontab.
I hope that you find this script useful. You can tweak it and use it for other interesting Asana projects configurations.

Juan.

Top comments (0)