I am trying to add a recurring task to todoist using the python api.
I tried this below but don't know how to specify the recurring settings
from pytodoist import todoist
user = todoist.login('login', 'pass')
project = user.get_project('my_project')
task = project.add_task('My Recuring task')
task = project.add_task('My Recuring task tomorrow at 2 pm')
I recommend you to use our main library.
Here is a one-liner that creates a new task for every day:
python2.7 -c "import todoist; import os; token = os.environ.get('token'); api = todoist.TodoistAPI(token); api.items.add('test', None, date_string='ev day'); api.commit()"
Breaking it down:
# import the library
import todoist
# retrieve the token from my environment variables
import os
token = os.environ.get('token');
# initialize the API object
api = todoist.TodoistAPI(token)
# Create a new task called "test", with "None" as the project id and date_string as kwargs for the arguments of the item.
api.items.add('test', None, date_string='ev day')
# commit it! :)
api.commit()"
In the last argument you can pass all arguments available in the documentation as command arguments