Python Todoist



  • To-do list app in Python. Inspired by the diary app in the Databases in Python course of Kenneth Love, I've made a to-do list app. It lets you add and delete entries, modify them, as well as flag them 'DONE'.
  • Add the Todoist Python Library. The good folks at Doist created a library that makes our job really easy. In order to add it click on requirements.txt and add a new line todoist-python. Write the Codes. Ok now we just need to write the code that will make your shiny new cloud function do cool stuff.
  • The Todoist Sync API is used by our web and mobile applications and is recommended for clients that will maintain a local representation of a user's full account data. It allows for incrementally sending and receiving account data by identifying positions in an account's state history using a sync token.

You can install todoist python library via pip: $ pip install todoist-python We currently have an official Python library supported by Doist to make the developer life easier. You can find the Python library source code at its repository at Github.

Todoist is a great task management application, and personally my favorite (after testing at least 5 of such apps), which I have been using on a daily basis for the past couple of months.
The app is really easy to use, with a simple interface, yet very powerful. It is also available on basically every existing platform (iOS, Android, Windows, Mac, Web…)

By the way, if you don’t have an account yet, you can register using this link, and you’ll get 2 months of premium for free.

One of the main things that drew my attention in this app is its reporting feature, which allows you to check completed tasks from the past days and weeks, giving the idea of how productive you are.

Even beign really useful, there is no easy way to check and visualize further details about your historical taksks, and hence my ideia of expanding this feature.

Fortunately, there is an official Todoist Sync API, and even better, an official Todoist Python library to interact with it, called todoist-python. Both were developed by Doist and are publicly available.
The Sync API documentation can be found here, and the todoist-python library documentation here.
You can install the library via pip: pip install todoist-python.

Along with the todoist-python, I will use pandas in a Jupyter environment for this demonstration.

The first thing to do is getting your API token, which is needed to login to your account. It can be easily found inside the Todoist app, you just have to go to Settings -> Integrations, and scroll down to API token. It is a big text of letters and numbers.

Python Todoist

Then, to the code:

Creating the “Projects” DataFrame

We are now logged in to Todoist, and can start retrieving data from it.
The first data I’ll retrieve are my projects, which are available in the api.state['projects'] object:

Creating the “Tasks” DataFrame

Next, I will retrieve all the tasks I have created, available at the api.state['items'] object. It is the same idea as in the step above:

This DataFrame is a bit more detailed, and it deserves a bit of handling before continuing:

Creating the “Tasks activities” DataFrame

Now it’s time for perhaps the most important dataset: the Activity Log
The activity log makes it easy to see everything that is happening across projects and tasks. It logs whenever a task is added, updated, completed…

Activity log is only available for Todoist Premium.

The activity_list is now a single list containing multiple dictionaries, and each dictionary represents one activity. The dicts contain the same keys, but the extra_data key is a nested object, which can vary between activities. Therefore, I have to handle it first before creating the DataFrame:

This DataFrame is also quite detailed, so I will perform steps similar to the ones performed on the “Tasks” DataFrame:

Now that we have all DataFrames, it is time for some visualization. Here are the questions I came up with:

Todoist-python Pip

  1. What are my Todoist statistics (sums, averages…)?
  2. How is my productivity over time?
  3. How are my task activities distributed among projects?
  4. On which day of the week am I most productive?

1. What are my Todoist statistics (sums, averages…)?

Printed:

2. How is my productivity over time?

3. How are my task activities distributed among projects?

4. On which day of the week am I most productive?

Todoist

There are plenty more stuff to be analyzed within Todoist, but I will leave it to another opportunity. Perhaps when I have more data since I am using the app for about 3 months only.

Python To Dict

Python Todoist
Please enable JavaScript to view the comments powered by Disqus.




Comments are closed.