HTTP API client library for Taskdog server.
This package provides a type-safe HTTP client for communicating with the Taskdog API server. It handles authentication, error mapping, and response conversion to domain DTOs.
Use cases:
- Building custom CLI tools
- Integrating Taskdog with other systems
- Creating automated workflows
- Testing API endpoints
pip install taskdog-clientFor development:
pip install -e ".[dev]"| Client | Purpose |
|---|---|
TaskClient |
Task CRUD operations (create, update, delete, archive) |
LifecycleClient |
Status changes (start, complete, pause, cancel, reopen) |
RelationshipClient |
Dependencies and tags |
QueryClient |
List tasks, get task details |
AnalyticsClient |
Statistics and Gantt data |
NotesClient |
Task notes (markdown) |
AuditClient |
Audit log access |
BaseApiClient |
Base class with common HTTP logic |
from taskdog_client import TaskClient, LifecycleClient, QueryClient
# Create clients
base_url = "http://127.0.0.1:8000"
api_key = "your-api-key" # Optional, for authenticated servers
task_client = TaskClient(base_url, api_key)
lifecycle_client = LifecycleClient(base_url, api_key)
query_client = QueryClient(base_url, api_key)
# Create a task
task = task_client.create_task(
name="My Task",
priority=100,
estimated_duration=8.0,
tags=["backend"]
)
print(f"Created task: {task.id}")
# List tasks
tasks = query_client.list_tasks(status="pending")
for t in tasks:
print(f"- {t.name} (ID: {t.id})")
# Start a task
lifecycle_client.start_task(task.id)
# Complete a task
lifecycle_client.complete_task(task.id)Clients raise exceptions from taskdog_core.domain.exceptions:
from taskdog_core.domain.exceptions import TaskNotFoundException, TaskValidationError
try:
task_client.get_task(999)
except TaskNotFoundException:
print("Task not found")
except TaskValidationError as e:
print(f"Validation error: {e}")Clients accept optional configuration:
from taskdog_client import TaskClient
# Basic usage (no auth)
client = TaskClient("http://127.0.0.1:8000")
# With API key authentication
client = TaskClient(
base_url="http://127.0.0.1:8000",
api_key="your-secret-key"
)
# Custom timeout (in seconds)
client = TaskClient(
base_url="http://127.0.0.1:8000",
timeout=30.0
)taskdog-core: Domain DTOs and exceptionshttpx: HTTP client library
- taskdog-core: Domain DTOs used by this package
- taskdog-server: API server this client connects to
- taskdog-ui: CLI/TUI that uses this client
- taskdog-mcp: MCP server that uses this client
pytest tests/MIT