Overview

The official Todoist Python API library.

Modules

todoist

todoist.api

exception todoist.api.SyncError[source]

Bases: exceptions.Exception

class todoist.api.TodoistAPI(token='', api_endpoint='https://todoist.com', session=None, cache='~/.todoist-sync/')[source]

Bases: object

Implements the API that makes it possible to interact with a Todoist user account and its data.

classmethod deserialize(data)[source]
reset_state()[source]
serialize()[source]
get_api_url()[source]
generate_uuid()[source]

Generates a uuid.

sync(commands=None)[source]

Sends to the server the changes that were made locally, and also fetches the latest updated data from the server.

commit(raise_on_error=True)[source]

Commits all requests that are queued. Note that, without calling this method none of the changes that are made to the objects are actually synchronized to the server, unless one of the aforementioned Sync API calls are called directly.

query(queries, **kwargs)[source]

DEPRECATED: query endpoint is deprecated for a long time and this method will be removed in the next major version of todoist-python

add_item(content, **kwargs)[source]

Adds a new task.

todoist.api.state_default(obj)[source]
todoist.api.json_default(obj)[source]
todoist.api.json_dumps(obj, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, cls=None, indent=None, encoding='utf-8', sort_keys=False, **kw)

Serialize obj to a JSON formatted str.

If skipkeys is true then dict keys that are not basic types (str, unicode, int, long, float, bool, None) will be skipped instead of raising a TypeError.

If ensure_ascii is false, all non-ASCII characters are not escaped, and the return value may be a unicode instance. See dump for details.

If check_circular is false, then the circular reference check for container types will be skipped and a circular reference will result in an OverflowError (or worse).

If allow_nan is false, then it will be a ValueError to serialize out of range float values (nan, inf, -inf) in strict compliance of the JSON specification, instead of using the JavaScript equivalents (NaN, Infinity, -Infinity).

If indent is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. None is the most compact representation. Since the default item separator is ', ', the output might include trailing whitespace when indent is specified. You can use separators=(',', ': ') to avoid this.

If separators is an (item_separator, dict_separator) tuple then it will be used instead of the default (', ', ': ') separators. (',', ':') is the most compact JSON representation.

encoding is the character encoding for str instances, default is UTF-8.

default(obj) is a function that should return a serializable version of obj or raise TypeError. The default simply raises TypeError.

If sort_keys is true (default: False), then the output of dictionaries will be sorted by key.

To use a custom JSONEncoder subclass (e.g. one that overrides the .default() method to serialize additional types), specify it with the cls kwarg; otherwise JSONEncoder is used.

todoist.models

class todoist.models.Model(data, api)[source]

Bases: object

Implements a generic object.

class todoist.models.Collaborator(data, api)[source]

Bases: todoist.models.Model

Implements a collaborator.

delete(project_id)[source]

Deletes a collaborator from a shared project.

class todoist.models.CollaboratorState(data, api)[source]

Bases: todoist.models.Model

Implements a collaborator state.

class todoist.models.Filter(data, api)[source]

Bases: todoist.models.Model

Implements a filter.

update(**kwargs)[source]

Updates filter.

delete()[source]

Deletes filter.

class todoist.models.Item(data, api)[source]

Bases: todoist.models.Model

Implements an item.

update(**kwargs)[source]

Updates item.

delete()[source]

Deletes item.

move(**kwargs)[source]

Moves item to another parent or project.

close()[source]

Marks item as closed

complete(date_completed=None)[source]

Marks item as completed.

uncomplete()[source]

Marks item as uncompleted.

archive()[source]

Marks item as archived.

unarchive()[source]

Marks item as unarchived.

update_date_complete(new_date_utc=None, date_string=None, is_forward=None)[source]

Completes a recurring task.

class todoist.models.Label(data, api)[source]

Bases: todoist.models.Model

Implements a label.

update(**kwargs)[source]

Updates label.

delete()[source]

Deletes label.

class todoist.models.LiveNotification(data, api)[source]

Bases: todoist.models.Model

Implements a live notification.

class todoist.models.GenericNote(data, api)[source]

Bases: todoist.models.Model

Implements a note.

local_manager = None

has to be defined in subclasses

update(**kwargs)[source]

Updates note.

delete()[source]

Deletes note.

class todoist.models.Note(data, api)[source]

Bases: todoist.models.GenericNote

Implement an item note.

class todoist.models.ProjectNote(data, api)[source]

Bases: todoist.models.GenericNote

Implement a project note.

class todoist.models.Project(data, api)[source]

Bases: todoist.models.Model

Implements a project.

update(**kwargs)[source]

Updates project.

delete()[source]

Deletes project.

archive()[source]

Marks project as archived.

unarchive()[source]

Marks project as unarchived.

move(parent_id)[source]

Moves item to another parent.

share(email)[source]

Shares projects with a user.

take_ownership()[source]

Takes ownership of a shared project.

class todoist.models.Reminder(data, api)[source]

Bases: todoist.models.Model

Implements a reminder.

update(**kwargs)[source]

Updates reminder.

delete()[source]

Deletes reminder.

todoist.managers

class todoist.managers.projects.ProjectsManager(api)[source]

Bases: todoist.managers.generic.Manager, todoist.managers.generic.AllMixin, todoist.managers.generic.GetByIdMixin, todoist.managers.generic.SyncMixin

state_name = 'projects'
object_type = 'project'
add(name, **kwargs)[source]

Creates a local project object.

update(project_id, **kwargs)[source]

Updates a project remotely.

delete(project_id)[source]

Deletes a project remotely.

archive(project_id)[source]

Marks project as archived remotely.

unarchive(project_id)[source]

Marks project as unarchived remotely.

move(project_id, parent_id)[source]

Moves project to another parent.

reorder(projects)[source]

Updates the child_order of the specified projects.

share(project_id, email)[source]

Shares a project with a user.

get_archived()[source]

Returns archived projects.

get_data(project_id)[source]

Returns a project’s uncompleted items.

get(project_id)[source]

Gets an existing project.

class todoist.managers.items.ItemsManager(api)[source]

Bases: todoist.managers.generic.Manager, todoist.managers.generic.AllMixin, todoist.managers.generic.GetByIdMixin, todoist.managers.generic.SyncMixin

state_name = 'items'
object_type = 'item'
add(content, **kwargs)[source]

Creates a local item object.

update(item_id, **kwargs)[source]

Updates an item remotely.

delete(item_id)[source]

Delete items remotely.

move(item_id, **kwargs)[source]

Moves item to another parent or project remotely.

close(item_id)[source]

Marks item as done

complete(item_id, date_completed=None, force_history=None)[source]

Marks item as completed remotely.

uncomplete(item_id)[source]

Marks item as uncompleted remotely.

archive(item_id)[source]

Marks item as archived remotely.

unarchive(item_id)[source]

Marks item as unarchived remotely.

update_date_complete(item_id, due=None)[source]

Completes a recurring task remotely.

reorder(items)[source]

Updates the child_order of the specified items.

update_day_orders(ids_to_orders)[source]

Updates in the local state the day orders of multiple items remotely.

get_completed(project_id, **kwargs)[source]

Returns a project’s completed items.

get(item_id)[source]

Gets an existing item.

class todoist.managers.labels.LabelsManager(api)[source]

Bases: todoist.managers.generic.Manager, todoist.managers.generic.AllMixin, todoist.managers.generic.GetByIdMixin, todoist.managers.generic.SyncMixin

state_name = 'labels'
object_type = 'label'
add(name, **kwargs)[source]

Creates a local label object.

update(label_id, **kwargs)[source]

Updates a label remotely.

delete(label_id)[source]

Deletes a label remotely.

update_orders(id_order_mapping)[source]

Updates the orders of multiple labels remotely.

get(label_id)[source]

Gets an existing label.

class todoist.managers.notes.GenericNotesManager(api)[source]

Bases: todoist.managers.generic.Manager, todoist.managers.generic.AllMixin, todoist.managers.generic.GetByIdMixin, todoist.managers.generic.SyncMixin

object_type = 'note'
update(note_id, **kwargs)[source]

Updates an note remotely.

delete(note_id)[source]

Deletes an note remotely.

class todoist.managers.notes.NotesManager(api)[source]

Bases: todoist.managers.notes.GenericNotesManager

state_name = 'notes'
add(item_id, content, **kwargs)[source]

Creates a local item note object.

get(note_id)[source]

Gets an existing note.

class todoist.managers.notes.ProjectNotesManager(api)[source]

Bases: todoist.managers.notes.GenericNotesManager

state_name = 'project_notes'
add(project_id, content, **kwargs)[source]

Creates a local project note object.

class todoist.managers.filters.FiltersManager(api)[source]

Bases: todoist.managers.generic.Manager, todoist.managers.generic.AllMixin, todoist.managers.generic.GetByIdMixin, todoist.managers.generic.SyncMixin

state_name = 'filters'
object_type = 'filter'
add(name, query, **kwargs)[source]

Creates a local filter object.

update(filter_id, **kwargs)[source]

Updates a filter remotely.

delete(filter_id)[source]

Deletes a filter remotely.

update_orders(id_order_mapping)[source]

Updates the orders of multiple filters remotely.

get(filter_id)[source]

Gets an existing filter.

class todoist.managers.reminders.RemindersManager(api)[source]

Bases: todoist.managers.generic.Manager, todoist.managers.generic.AllMixin, todoist.managers.generic.GetByIdMixin, todoist.managers.generic.SyncMixin

state_name = 'reminders'
object_type = 'reminder'
add(item_id, **kwargs)[source]

Creates a local reminder object.

update(reminder_id, **kwargs)[source]

Updates a reminder remotely.

delete(reminder_id)[source]

Deletes a reminder remotely.

get(reminder_id)[source]

Gets an existing reminder.

class todoist.managers.locations.LocationsManager(api)[source]

Bases: todoist.managers.generic.Manager, todoist.managers.generic.AllMixin, todoist.managers.generic.SyncMixin

state_name = 'locations'
object_type = None
clear()[source]

Clears the locations.

class todoist.managers.user.UserManager(api)[source]

Bases: todoist.managers.generic.Manager

update(**kwargs)[source]

Updates the user data.

update_goals(**kwargs)[source]

Updates the user’s karma goals.

sync()[source]
get(key=None, default=None)[source]
get_id()[source]
login(email, password)[source]

Logins user, and returns the response received by the server.

login_with_google(email, oauth2_token, **kwargs)[source]

Logins user with Google account, and returns the response received by the server.

register(email, full_name, password, **kwargs)[source]

Registers a new user.

delete(current_password, **kwargs)[source]

Deletes an existing user.

update_notification_setting(notification_type, service, dont_notify)[source]

Updates the user’s notification settings.

class todoist.managers.invitations.InvitationsManager(api)[source]

Bases: todoist.managers.generic.Manager, todoist.managers.generic.SyncMixin

state_name = None
object_type = 'share_invitation'
accept(invitation_id, invitation_secret)[source]

Accepts an invitation to share a project.

reject(invitation_id, invitation_secret)[source]

Rejets an invitation to share a project.

delete(invitation_id)[source]

Delete an invitation to share a project.

class todoist.managers.collaborators.CollaboratorsManager(api)[source]

Bases: todoist.managers.generic.Manager, todoist.managers.generic.GetByIdMixin, todoist.managers.generic.SyncMixin

state_name = 'collaborators'
object_type = None
delete(project_id, email)[source]

Deletes a collaborator from a shared project.

class todoist.managers.collaborator_states.CollaboratorStatesManager(api)[source]

Bases: todoist.managers.generic.Manager, todoist.managers.generic.SyncMixin

state_name = 'collaborator_states'
object_type = None
get_by_ids(project_id, user_id)[source]

Finds and returns the collaborator state based on the project and user ids.

class todoist.managers.biz_invitations.BizInvitationsManager(api)[source]

Bases: todoist.managers.generic.Manager

state_name = None
object_type = None
accept(invitation_id, invitation_secret)[source]

Accepts a business invitation to share a project.

reject(invitation_id, invitation_secret)[source]

Rejects a business invitation to share a project.

class todoist.managers.live_notifications.LiveNotificationsManager(api)[source]

Bases: todoist.managers.generic.Manager, todoist.managers.generic.GetByIdMixin, todoist.managers.generic.AllMixin, todoist.managers.generic.SyncMixin

state_name = 'live_notifications'
object_type = None
set_last_read(id)[source]

Sets the last known notification.

mark_read(id)[source]

Marks notification as read.

mark_read_all()[source]

Marks all notifications as read.

mark_unread(id)[source]

Marks notification as unread.

class todoist.managers.generic.Manager(api)[source]

Bases: object

state_name = None
object_type = None
state
queue
token
class todoist.managers.generic.AllMixin[source]

Bases: object

all(filt=None)[source]
class todoist.managers.generic.GetByIdMixin[source]

Bases: object

get_by_id(obj_id, only_local=False)[source]

Finds and returns the object based on its id.

class todoist.managers.generic.SyncMixin[source]

Bases: object

Syncs this specific type of objects.

sync()[source]

Indices and tables