Python client for Dida365/TickTick API
Project description
dida365-api
An unofficial Python client library for the Dida365/TickTick API, supporting both the Chinese (Dida365) and international (TickTick) versions of the service. Built with modern async Python and robust error handling.
Forked from Cyfine/TickTick-Dida365-API-Client — thanks to Carter Yifeng Cheng (@cyfine) for the original project.
This is a community package created to facilitate task management automation. It is not affiliated with or endorsed by Dida365 or TickTick.
Installation
pip install dida365-api
To install the latest development version directly from GitHub:
pip install git+https://github.com/Konano/dida365-api.git
Quick Start
import asyncio
from dida365 import Dida365Client, ServiceType, TaskCreate, TaskPriority
async def main():
# Credentials can be passed via constructor, .env file, or environment variables
client = Dida365Client(
client_id="your_client_id",
client_secret="your_client_secret",
service_type=ServiceType.TICKTICK, # or ServiceType.DIDA365
redirect_uri="http://localhost:8080/callback",
save_to_env=True, # automatically save credentials & tokens to .env
# access_token="your_access_token", # If you already have an access_token, pass it directly to skip OAuth
)
# First-time authentication (opens browser, starts local callback server)
if not client.auth.token:
await client.authenticate()
# Create a task
task = await client.create_task(
TaskCreate(
project_id="your_project_id",
title="My new task",
content="Task description",
priority=TaskPriority.HIGH,
)
)
print(f"Created task: {task.title}")
if __name__ == "__main__":
asyncio.run(main())
Configuration
Credentials can be provided in three ways (checked in this order):
- Constructor parameters — directly pass
client_id,client_secret,access_token, etc. .envfile — create a.envin your working directory- Environment variables
Example .env file:
DIDA365_CLIENT_ID=your_client_id
DIDA365_CLIENT_SECRET=your_client_secret
DIDA365_REDIRECT_URI=http://localhost:8080/callback
DIDA365_SERVICE_TYPE=ticktick # or dida365
DIDA365_ACCESS_TOKEN=your_token # optional: set to skip OAuth flow
OAuth2 Setup
- Get your credentials:
- TickTick: https://developer.ticktick.com/manage
- Dida365: https://developer.dida365.com/manage
- Click New App, then note your Client ID and Client Secret.
- In your app's settings, add the redirect URL:
http://localhost:8080/callback
API Reference
Official documentation:
- Dida365 API: https://developer.dida365.com/api#/openapi
- TickTick API: https://developer.ticktick.com/docs#/openapi
Usage
Tasks
from dida365 import TaskCreate, TaskUpdate, TaskPriority, TaskStatus
# Create
task = await client.create_task(
TaskCreate(
project_id="project_id",
title="Complete documentation",
priority=TaskPriority.HIGH,
)
)
# Read
task = await client.get_task(project_id="project_id", task_id=task.id)
# Update
task = await client.update_task(
TaskUpdate(
id=task.id,
project_id=task.project_id,
title="Updated title",
)
)
# Complete
await client.complete_task(project_id=task.project_id, task_id=task.id)
# Delete
await client.delete_task(project_id=task.project_id, task_id=task.id)
# Filter tasks
tasks = await client.filter_tasks(
project_ids=["project_id"],
priority=[TaskPriority.HIGH],
status=[TaskStatus.NORMAL],
)
Projects
from dida365 import ProjectCreate, ProjectUpdate, ViewMode
# Create
project = await client.create_project(
ProjectCreate(name="My Project", color="#FF0000", view_mode=ViewMode.KANBAN)
)
# List all
projects = await client.get_projects()
# Get with tasks & columns
data = await client.get_project_with_data(project_id=project.id)
# Update
project = await client.update_project(
ProjectUpdate(id=project.id, name="Renamed Project")
)
# Delete
await client.delete_project(project_id=project.id)
Tags
from dida365 import TagCreate
# List tags
tags = await client.get_tags()
# Create a tag
tag = await client.create_tag(TagCreate(name="urgent", label="urgent"))
Habits
from dida365 import HabitCreate, HabitUpdate
# List all habits
habits = await client.get_all_habits()
# Create a habit
habit = await client.create_habit(
HabitCreate(name="Morning run", color="#00FF00", sort_order=0)
)
# Update a habit
habit = await client.update_habit(habit_id=habit.id, habit=HabitUpdate(name="Evening run"))
# Get habit checkins
checkins = await client.get_habit_checkins(
habit_ids=habit.id, from_stamp=20240101, to_stamp=20240131
)
Focus
from datetime import datetime, timezone, timedelta
from dida365 import FocusCreate, FocusType
# Get focus sessions
sessions = await client.get_focuses(
from_date="2024-01-01T00:00:00+0800",
to_date="2024-01-31T00:00:00+0800",
focus_type=FocusType.POMODORO,
)
# Create a focus session
focus = await client.create_focus(
FocusCreate(
type=FocusType.POMODORO,
start_time=datetime(2024, 1, 1, 9, 0, 0, tzinfo=timezone(timedelta(hours=8))),
end_time=datetime(2024, 1, 1, 9, 25, 0, tzinfo=timezone(timedelta(hours=8))),
duration=1500,
)
)
Countdown
# List all countdowns
countdowns = await client.get_countdowns()
Requirements
- Python 3.10 or higher
Contributing
Contributions are welcome! Feel free to submit a Pull Request.
License
This project is licensed under the MIT License — see the LICENSE file for details.
Author
Original project by Carter Yifeng Cheng (@cyfine).
This fork maintained by Konano.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dida365_api-0.2.4.tar.gz.
File metadata
- Download URL: dida365_api-0.2.4.tar.gz
- Upload date:
- Size: 26.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3005805d537edcbd435ef2d7f118c856ae3fd2538cff0024b58e0e6ff7b167e9
|
|
| MD5 |
e49cae650d9c426f23fecbf94fdc61f8
|
|
| BLAKE2b-256 |
b2b57238d9e7b8561391903bce8ccd5a015a1d648b00ee199d7c133b94bc401a
|
Provenance
The following attestation bundles were made for dida365_api-0.2.4.tar.gz:
Publisher:
publish.yml on Konano/dida365-api
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dida365_api-0.2.4.tar.gz -
Subject digest:
3005805d537edcbd435ef2d7f118c856ae3fd2538cff0024b58e0e6ff7b167e9 - Sigstore transparency entry: 2085942984
- Sigstore integration time:
-
Permalink:
Konano/dida365-api@23e0851848031732a2ab52722f92f2feb966e63e -
Branch / Tag:
refs/tags/v0.2.4 - Owner: https://github.com/Konano
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@23e0851848031732a2ab52722f92f2feb966e63e -
Trigger Event:
push
-
Statement type:
File details
Details for the file dida365_api-0.2.4-py3-none-any.whl.
File metadata
- Download URL: dida365_api-0.2.4-py3-none-any.whl
- Upload date:
- Size: 27.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2c060e928d6a6e0cb96c31a07482486efd6cf3ea5c6ae5ae8cce52dc96662003
|
|
| MD5 |
577801b992dcd74cd9c6269a6e553049
|
|
| BLAKE2b-256 |
b90e77515440f6a7be98ae8b33dc734cc0497096965f4e72d6605d6875159f3a
|
Provenance
The following attestation bundles were made for dida365_api-0.2.4-py3-none-any.whl:
Publisher:
publish.yml on Konano/dida365-api
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dida365_api-0.2.4-py3-none-any.whl -
Subject digest:
2c060e928d6a6e0cb96c31a07482486efd6cf3ea5c6ae5ae8cce52dc96662003 - Sigstore transparency entry: 2085943336
- Sigstore integration time:
-
Permalink:
Konano/dida365-api@23e0851848031732a2ab52722f92f2feb966e63e -
Branch / Tag:
refs/tags/v0.2.4 - Owner: https://github.com/Konano
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@23e0851848031732a2ab52722f92f2feb966e63e -
Trigger Event:
push
-
Statement type: