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.