- Todoist Python Tutorial
- Todoist Python
- Todoist Install Python
- Todoist Python Download
- Todoist Python Api
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. Implements the API that makes it possible to interact with a Todoist user account and its data. Generates a uuid. Sends to the server the changes that were made locally, and also fetches the latest updated data from the server. Commits all requests that are queued.
Should every dev blog has some “open source project that I’m currently working on in my free time”?? Probably not but I will show you mine. Just in case it should… 😉
Why?
It’s console client for todoist task management app. Whole idea comes from one reason.
Too many open tabs in browser ⇨ Let’s close todoist ⇨ don’t look at tasks ⇨ don’t do tasks 😒.
First think that came to my mind was a little widget on desktop but let’s be honest… I would close it too. So where I spend most of my time working? VS Code and console! The choice was simple. Almost as quick as checking git status
I can type todoist
and look at my tasks 🎉.
Take a look!
Let’s clear something up
The goal was not to implement all todoist API functions in console. The goal was to build the fastest access to basic functions like show tasks, add task, complete task. I’m not going to describe all work here now, instead I’ll try to show you what you can learn from such simple ‘app’ 😉.
Connection
I have used todoist Sync API with python. It’s quite simple, all you need to have is your user token. Find it in your settings ⇨ integrations ⇨ token. Base on it create client object which will make all magic for you ✨.
And since then you have all your information up to date.
Config
I have prepared some config file. So far you can set your token and emojis there, but I hope it will grow a bit. You can set your token by passing it to JSON file, or I have prepared a command for you 🎀. It will load config, change it and save it again.
- To set the token use
todoist --set-token your_token
.
Make it work!
Below are some basic commands. Remember that I’m still developing this project in my free time. You will probably see some differences. The most up-to-date version will be on GitHub so check out README file.
- To get tasks that are/were for today and those overdue use
todoist list
. - To add task with default date value as current day, you don’t have to use –date flag. In case you want to specify date use YYYY-MM-DD format.
todoist --add 'name of your task' --date yyy-mm-dd
. - To complete task
todoist --complete id_of_task
.
Released:
Actionista Action CLI for Todoist. Add, select, print, reschedule, modify, and complete tasks in a batch-wise fashion from the command line.
Project description
Actionista Action CLI for Todoist.
Manage your Todoist tasks from the command line, using powerful filters toselect, print, reschedule, and complete tasks in a batch-wise fashion.
Do you have dozens or even hundreds of overdue tasks on your agenda?Clear up your task list in seconds, using the Actionista Action CLI for Todoist.You can now take the rest of the day off with a clear conscience.
This Action CLI for Todoist (todoist-action-cli
), operates sequentially on a list of tasks.You start out with a list of all tasks, and then select tasks using one of the manyfilters available. You can then sort, print, and reschedule the selected tasks.
Actionista Action-Chain CLI for Todoist (actionista-todoist)is inspired by the powerful find
command line tool. It takes the 'chain of actions'approach that find
uses to find and select files on your harddisk,and applies it for managing your Todoist task list.
The successful find
utility works by supplying a sequence of 'actions'(also known as 'expressions' in the find
manual).
Most actions are essentially filters, where you list criteria for the files to find.However, the real usability of find
is that it can not only print the matching files,but also use the matching files for other actions, e.g. deleting the files,or sending them to other command line tools.
The actionista action-chain CLI takes a similar approach.Starting from the full list of tasks, you can apply filters to find exactly those tasks that you need.Together with other actions, you can print
, reschedule
, rename
, mark-complete
, or delete
whatever tasks you need.You can invoke as many actions as you need, both filters and other actions, in any order.The actions are invoked in exactly the order you specify.
So if you want, you can filter tasks by e.g. project name, and print all tasks in a given project,then filter by due date, and print again, then reschedule the tasks that were just printed,then filter by exact name, then mark that (or those) remaining task(s) as complete,and finally commit the changes to the server.This example is mostly just to show what is possible,and I personally wouldn't recommend having such a complex list of actions,but you are basically free to list as many (or as few) actions as you want or need.For the record, doing the described sequence of actions would look something like this:
Usually, for your own sanity, command line usage would be a little more simple, and have only a single 'purpose'with each invocation:
The generalized command line usage is:
You can also import the package from python:
Note: This package was formerly imported as rsenv.rstodo.todoist_action_cli
,but has now been separated into its own package, imported as: actionista.todoist_action_cli
.
NOTE: This application is not created by, affiliated with, or supported by Doist.It is a third-party command line utility that is making use of the official Todoist API,as documented by https://developer.todoist.com/sync/v8/.
INSTALLATION:
Installation with pipx
:
For regular end-users, I recommend using pipx
to install the Actionista-Todoist command line apps:
If you don't have pipx installed, you can refer to thepipx installation guide.Briefly:
The last step will add ~/.local/bin
to the PATH environment variable.Please make sure to close and restart your terminal/command prompt afterinstalling pipx for the first time.
Known installation errors:
- If you are using
conda
, there is a known issue where you receive an error,'Error: [Errno 2] No such file or directory:', when trying to install packages withpipx
.If you get this error, please update yourconda
python and make sure you are only usingthe 'defaults' channel, not 'conda-forge'.
Installation with pip
:
To install distribution release package from the Python Packaging Index (PyPI):
Alternatively, install the latest git master source by fetching the git repository from githuband install the package in editable mode (development mode):
CONFIGURATION:
Once actionista-todoist
package is installed, you need to obtain a login token from the todoist website:Log into your todoist.com account, go to Settings -> Integrations
, and copy the API token.(You can also go directly to the page: https://todoist.com/prefs/integrations).
Now run:
to set up the login token with your Actionista-Todoist installation.The API token is stored in ~/.todoist_token.txt
.The actionista-todoist-config
command will also create a default config file,~/.todoist_config.yaml
, which you can edit to change default sorting and printing format.
If you re-set your Todoist API token, you can update it either by running:
or by manually editing the file ~/.todoist_token.txt
and place your token in here.
USAGE:
The actionista-todoist
package contains several command line apps (CLIs):
todoist-action-cli
- also available asactionista-todoist
.todoist-cli
.actionista-todoist-config
.
The todoist-action-cli
CLI program uses the 'action chain' approach, where you specify a sequenceof 'actions', which are used to filter/select tasks from Todoist and then sort, print, or reschedulethe selected tasks in a batch-wise fashion.
The todoist-cli
CLI program is used mostly for things that doesn't fit the 'action chain' philosophy.For instance, if you want to add a new task, that doesn't really fit into the todoist-action-cli
workflow.(*) Instead, you can use todoist-cli add-task
command to add a new task to Todoist.The todoist-cli
is also used for other things, e.g. printing a list of your projects, etc.You can run todoist-cli --help
to see all available commands.
Finally, the actionista-todoist-config
CLI program is used to set up Actionista-Todoist,configuring your API login token, and creating a default configuration file.
(*) The todoist-action-cli
can technically be used to add tasks to Todoist, using the-add-task
action command - however, this is not the recommended approach.
todoist-action-cli
usage:
The general command line usage is:
Where action
is one of the following actions:
To see how to use each filter, type:
E.g.:
As you can see, typical usage is:
The filter actions could be e.g. filtering by -name
(same as -content
),project
, due_date_local_iso
, etc.The -sync
action is optional; if you do not specify -sync
, the program will just re-use the old cache,from last time you invoked -sync
. You must invoke -sync
at least once, when you first install this package,and you should always -sync
if you have made any changes (e.g. from your phone) since your last sync.Finally, the -sort
and -print
commands will sort and print the selected tasks.
If you need to refine your filters, just run the command again. The data is cached locally,so if you omit the -sync
action, commands can be executed in rapid succession.
Todoist Python Tutorial
Another example, to reschedule the due date for a bunch of tasks, would look like:
NOTE: I strongly recommend that you -print
the filtered tasks before you-rename
or -reschedule
the tasks. When you invoke -commit
, the changes cannot be undone automatically,so you may easily end up with a bunch of identically-named tasks with the same due date, if you forgot toapply the correct selection filters before renaming or rescheduling the tasks!For this reason, the program will, by default, ask you for confirmation before every -commit
.
Action arguments:
Each action can be provided a set of arguments which are listed sequentially, separated by space.If one argument contains spaces, e.g. you are filtering by tasks in the project 'Meeting notes',then you need to quote the argument as such:
Here, we provided one argument to the -project
action ('Meeting notes'
),and two arguments to the -sort
action ('project_name,content'
and ascending
).
Some of the actions attempts to be 'clever' when interpreting the arguments given.For instance, when filtering by project, you can do either:
The general signature for the -project
action is:
Here, [operator]
is the name of one of the many registered binary operators.These are used to compare the tasks against a given value.In the example above, if you do not specify any operator, then the 'glob' operator is used.The 'glob' operator allows you to use wild-cards for selecting tasks, the same way you select files on the command line.In our case, we 'glob' against tasks with project name starting with the string 'Wedding*'.We could also have used the 'startswith' operator, and omit the asterisk: startswith Wedding
.
For more info on how to use operators, see:
Ad-hoc CLI:
Installing this project (actionista-todoist
) with pip
will also give you some'ad-hoc' command line interface entry points:
Todoist Python
Prior art: Other python-based Todoist projects
Other Todoist CLI packages that I know about:
todoist-cli -A command line interface for batch creating Todoist tasks from a file.Makes manual requests against the web API url (rather than using the official todoist-python package).No updates since January 2016 (except
setup.py
andrequirements.txt
).This probably doesn't work, given that it uses an old, obsolete API endpoint URL.todoicli - A rather new project (as of April 2018).Focuses on pre-defined queries for listing tasks, e.g. 'today and overdue', 'next 7 days', etc.Lots of other functionality, pretty extensive code base.Has integration with the toggl.com time tracking service.Uses the official
todoist-python
package, but still uses the'universal UTC' time format from the old v7 Sync API, and the v7 due-date structure.That means it probably won't work anymore, given that the v7 Sync API has been deprecated,and thetodoist-python
package has switched to Sync API v8.For instance, thelist td
andlist n7
usesitem['due_date_utc']
, which will raiseaKeyError
with the new v8 data structure.The CLI also expectsIDs
(task_id
,label_id
,project_id
), rather than text names,making it rather difficult to use for the end user.pydoist - A basic CLI to add Todoist tasks from the command line.Uses the official
todoist-python
python API from Todoist.Lastest release was November 2016, so may not work with the new v8 Sync API.
Other general python Todoist packages:
python-todoist - The official python'Todoist' package from Doist (the company behind Todoist).Is currently using the version 8.0 'Sync' API.
pytodoist - An alternative Todoist API package.Also uses the v7 Sync API.A rather different approach to API wrapping, perhaps more object oriented.Focused on modelling individual Users/Projects/Tasks/Notes,where the official todoist-python package has managers as the central unit(ItemsManager, ProjectsManager, NotesManager).
- Last update November 2016 - will be obsolete when the v7 Sync API is removed.
Release historyRelease notifications | RSS feed
2019.9.16
2019.9.10
2019.9.9
0.5.2
Todoist Install Python
0.5.1
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Filename, size | File type | Python version | Upload date | Hashes |
---|---|---|---|---|
Filename, size actionista_todoist-2019.9.16-py3-none-any.whl (75.7 kB) | File type Wheel | Python version py3 | Upload date | Hashes |
Filename, size actionista-todoist-2019.9.16.tar.gz (76.9 kB) | File type Source | Python version None | Upload date | Hashes |
Hashes for actionista_todoist-2019.9.16-py3-none-any.whl
Algorithm | Hash digest |
---|---|
SHA256 | 6ea37121004b7d92863a4fc17f49a4231738c9bcd86eec8d453b2c4599f9d20e |
MD5 | 6dbbbd90c3aaffd62a5f274478b7c126 |
BLAKE2-256 | 8b87d8dcf7e2e76e28815bf987a017e4ffc64a2f7d3c3623c85dc21bfa01c0bf |
Todoist Python Download
Hashes for actionista-todoist-2019.9.16.tar.gz
Todoist Python Api
Algorithm | Hash digest |
---|---|
SHA256 | dc8b751b26d42a8ddf02cea739138fc3106ff3f874d11f2f79cf8f7a591ff658 |
MD5 | 34fd2d258c38300ddd58863295fbbfb1 |
BLAKE2-256 | 882fe3f1551d1ccb2ef45fff1576c565f98525dc044c9dc4a8feca9f731946ee |