Create a tree from Todoist projects > sections > tasks
Project description
todoist_tree
These are the core functions of todoist_bot.
The reading and writing functions are just (sometimes typeguarded) aliases of Todoist api calls. The differentiating functionality is building a tree with
import time
from todoist_tree import headers
from todoist_tree import read_changes
from todoist_tree import tree
headers = new_headers(api_token)
todoist = None
sync_token: str = "*"
complete = False
while not complete:
todoist = read_changes.read_changes(headers)
if todoist is None:
# no changes or failure
time.sleep(2)
continue
sync_token = todoist.sync_token
projects = todoist.projects
sections = todoist.sections
tasks = todoist.tasks
id2node = tree.map_id_to_branch(
todoist.projects,
todoist.sections,
todoist.tasks
)
# do something here
time.sleep(5)
The tree doesn't have one root. map_id_to_branch
maps the id[1] of each project, section, and task to a node. Top-level projects will not have parents, so they are effectively roots of their own trees.
See todoist_bot for a full example.
[1] where id
is the value returned in the json dictionary from the Todoist api, not the Python object id.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file todoist_tree-0.4.0.tar.gz
.
File metadata
- Download URL: todoist_tree-0.4.0.tar.gz
- Upload date:
- Size: 8.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.2 CPython/3.11.2 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fc3efdd24be3d0ee703989fc4c69a036814c88b528462e301abef937907634b8 |
|
MD5 | af4c4e85e29f2736e8810ad50cd60299 |
|
BLAKE2b-256 | dcaae21b8b2e9222a3bc034094ed93e098cd884b93fbc9ee22a60b2510cca4af |
File details
Details for the file todoist_tree-0.4.0-py3-none-any.whl
.
File metadata
- Download URL: todoist_tree-0.4.0-py3-none-any.whl
- Upload date:
- Size: 9.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.2 CPython/3.11.2 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 03f5cc6fa1e38aa06b1666554cac49787eee17c43555d4c22199a99b658027fa |
|
MD5 | 497389480e3dc49eeb115e41d6536720 |
|
BLAKE2b-256 | 10ca1e86127db679ba68bf708e7f0c5c10c91d78188a74698d60582d644d8a4d |