# Taskflow SDK
Simple Python SDK for the Taskflow distributed task runner platform.
## 🚀 Quick Start
### Using the SDK
```python
from orkera import OrkeraClient
from datetime import datetime, timedelta
# Initialize client (API URL is automatically set to https://api.orkera.com)
client = OrkeraClient(
api_key="vgBSGW6A1zYDNHVIPB1Ctry2rR8DOCvg"
)
# Schedule a task
task_id = client.schedule_task(
task_name="calculate_sum",
task_kwargs={"a": 10, "b": 20},
timeout=300
)
print(f"Task scheduled: {task_id}")
# List all tasks
tasks = client.list_tasks()
print(f"Total tasks: {len(tasks)}")
# Get specific task
task = client.get_task(task_id)
print(f"Task status: {task['status']}")
```
### Using Raw HTTP Requests
```python
import requests
response = requests.post(
"http://localhost:8000/api/tasks/",
json={
"task_name": "calculate_sum",
"task_kwargs": {"a": 10, "b": 20},
"timeout": 300
},
headers={
"Authorization": "Bearer vgBSGW6A1zYDNHVIPB1Ctry2rR8DOCvg",
"Content-Type": "application/json"
}
)
task_id = response.json()["task_id"]
print(f"Task scheduled: {task_id}")
```
## 📦 Installation
### Install from source
```bash
pip install -e .
```
### Install dependencies only
```bash
pip install -r requirements.txt
```
## 🔧 Usage
### SDK Client
The `OrkeraClient` provides a clean interface for interacting with the Orkera server:
```python
from orkera import OrkeraClient
client = OrkeraClient("your-api-key")
# Schedule immediate task
task_id = client.schedule_task("my_task", task_kwargs={"param": "value"})
# Schedule delayed task
from datetime import datetime, timedelta
future_time = datetime.now() + timedelta(minutes=5)
task_id = client.schedule_task("my_task", schedule_time=future_time)
# Schedule with callback
task_id = client.schedule_task(
"my_task",
callback_url="http://myserver.com/webhook"
)
```
### FastAPI Example
Run the included FastAPI example:
```bash
python examples/rest_example.py
```
This starts a server on port 8080 with endpoints:
- `GET /` - API documentation
- `POST /schedule` - Schedule a test task
- `GET /status` - Check server status
## 📝 Examples
The `examples/` directory contains:
- `rest_example.py` - Complete FastAPI server showing task scheduling
## 🔐 Requirements
- Python 3.7+
- `requests>=2.25.0`
- `fastapi>=0.68.0` (for examples)
- `uvicorn>=0.15.0` (for examples)
## 🚨 Server Setup
Make sure your Django Taskflow server is running on `http://localhost:8000` with a valid API key.
## API Reference
### TaskflowClient
#### `__init__(server_url, api_key, timeout=30)`
Initialize the client with server URL and API key.
#### `schedule_task(task_name, task_args=None, task_kwargs=None, schedule_time=None, timeout=300, retry_count=0, callback_url=None)`
Schedule a task for execution.
#### `list_tasks()`
List all tasks for the authenticated user.
#### `get_task(task_id)`
Get details of a specific task.
Raw data
{
"_id": null,
"home_page": "https://github.com/orkera/python-sdk",
"name": "orkera",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "orkera, task, distributed, scheduler, async",
"author": "Orkera Team",
"author_email": "contact@orkera.com",
"download_url": "https://files.pythonhosted.org/packages/7f/f7/b7530d5df9080f5919f887d4dcc73ff8f16c7fd94c31b2e665450214f9b2/orkera-0.3.0.tar.gz",
"platform": null,
"description": "# Taskflow SDK\n\nSimple Python SDK for the Taskflow distributed task runner platform.\n\n## \ud83d\ude80 Quick Start\n\n### Using the SDK\n\n```python\nfrom orkera import OrkeraClient\nfrom datetime import datetime, timedelta\n\n# Initialize client (API URL is automatically set to https://api.orkera.com)\nclient = OrkeraClient(\n api_key=\"vgBSGW6A1zYDNHVIPB1Ctry2rR8DOCvg\"\n)\n\n# Schedule a task\ntask_id = client.schedule_task(\n task_name=\"calculate_sum\",\n task_kwargs={\"a\": 10, \"b\": 20},\n timeout=300\n)\n\nprint(f\"Task scheduled: {task_id}\")\n\n# List all tasks\ntasks = client.list_tasks()\nprint(f\"Total tasks: {len(tasks)}\")\n\n# Get specific task\ntask = client.get_task(task_id)\nprint(f\"Task status: {task['status']}\")\n```\n\n### Using Raw HTTP Requests\n\n```python\nimport requests\n\nresponse = requests.post(\n \"http://localhost:8000/api/tasks/\",\n json={\n \"task_name\": \"calculate_sum\",\n \"task_kwargs\": {\"a\": 10, \"b\": 20},\n \"timeout\": 300\n },\n headers={\n \"Authorization\": \"Bearer vgBSGW6A1zYDNHVIPB1Ctry2rR8DOCvg\",\n \"Content-Type\": \"application/json\"\n }\n)\n\ntask_id = response.json()[\"task_id\"]\nprint(f\"Task scheduled: {task_id}\")\n```\n\n## \ud83d\udce6 Installation\n\n### Install from source\n```bash\npip install -e .\n```\n\n### Install dependencies only\n```bash\npip install -r requirements.txt\n```\n\n## \ud83d\udd27 Usage\n\n### SDK Client\n\nThe `OrkeraClient` provides a clean interface for interacting with the Orkera server:\n\n```python\nfrom orkera import OrkeraClient\n\nclient = OrkeraClient(\"your-api-key\")\n\n# Schedule immediate task\ntask_id = client.schedule_task(\"my_task\", task_kwargs={\"param\": \"value\"})\n\n# Schedule delayed task\nfrom datetime import datetime, timedelta\nfuture_time = datetime.now() + timedelta(minutes=5)\ntask_id = client.schedule_task(\"my_task\", schedule_time=future_time)\n\n# Schedule with callback\ntask_id = client.schedule_task(\n \"my_task\", \n callback_url=\"http://myserver.com/webhook\"\n)\n```\n\n### FastAPI Example\n\nRun the included FastAPI example:\n\n```bash\npython examples/rest_example.py\n```\n\nThis starts a server on port 8080 with endpoints:\n- `GET /` - API documentation\n- `POST /schedule` - Schedule a test task\n- `GET /status` - Check server status\n\n## \ud83d\udcdd Examples\n\nThe `examples/` directory contains:\n- `rest_example.py` - Complete FastAPI server showing task scheduling\n\n## \ud83d\udd10 Requirements\n\n- Python 3.7+\n- `requests>=2.25.0`\n- `fastapi>=0.68.0` (for examples)\n- `uvicorn>=0.15.0` (for examples)\n\n## \ud83d\udea8 Server Setup\n\nMake sure your Django Taskflow server is running on `http://localhost:8000` with a valid API key.\n\n## API Reference\n\n### TaskflowClient\n\n#### `__init__(server_url, api_key, timeout=30)`\nInitialize the client with server URL and API key.\n\n#### `schedule_task(task_name, task_args=None, task_kwargs=None, schedule_time=None, timeout=300, retry_count=0, callback_url=None)`\nSchedule a task for execution.\n\n#### `list_tasks()`\nList all tasks for the authenticated user.\n\n#### `get_task(task_id)`\nGet details of a specific task.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Simple HTTP client for Orkera distributed task runner",
"version": "0.3.0",
"project_urls": {
"Bug Tracker": "https://github.com/orkera/python-sdk/issues",
"Documentation": "https://github.com/orkera/python-sdk",
"Homepage": "https://github.com/orkera/python-sdk",
"Source Code": "https://github.com/orkera/python-sdk"
},
"split_keywords": [
"orkera",
" task",
" distributed",
" scheduler",
" async"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "132e970708a6c07f4b252f407bc05ae3ad693391e71002d9072f1e4a1f67ab29",
"md5": "2517fe51cda0e3e7a7fd47c7d006e830",
"sha256": "dd421052edad36e0e23bad6fec095cef3476be79d25e50b00cda9ab12956ca74"
},
"downloads": -1,
"filename": "orkera-0.3.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "2517fe51cda0e3e7a7fd47c7d006e830",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 5087,
"upload_time": "2025-07-25T23:02:27",
"upload_time_iso_8601": "2025-07-25T23:02:27.071655Z",
"url": "https://files.pythonhosted.org/packages/13/2e/970708a6c07f4b252f407bc05ae3ad693391e71002d9072f1e4a1f67ab29/orkera-0.3.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "7ff7b7530d5df9080f5919f887d4dcc73ff8f16c7fd94c31b2e665450214f9b2",
"md5": "a4143af46cf75670de35f6dd65a35970",
"sha256": "af06f8f438a082a0fc9cc53a7ef0b104b0569bf1ba0dfae2d08166a71cdfc48e"
},
"downloads": -1,
"filename": "orkera-0.3.0.tar.gz",
"has_sig": false,
"md5_digest": "a4143af46cf75670de35f6dd65a35970",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 4724,
"upload_time": "2025-07-25T23:02:28",
"upload_time_iso_8601": "2025-07-25T23:02:28.425049Z",
"url": "https://files.pythonhosted.org/packages/7f/f7/b7530d5df9080f5919f887d4dcc73ff8f16c7fd94c31b2e665450214f9b2/orkera-0.3.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-25 23:02:28",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "orkera",
"github_project": "python-sdk",
"github_not_found": true,
"lcname": "orkera"
}