The official Python SDK for Task Badger
Project description
Task Badger Python Client
This is the official Python SDK for Task Badger.
For full documentation go to https://docs.taskbadger.net/python/.
Getting Started
Install
pip install --upgrade taskbadger
Client Usage
Configuration
import taskbadger
taskbadger.init(
organization_slug="my-org",
project_slug="my-project",
token="***"
)
API Example
from taskbadger import Task, Action, EmailIntegration, WebhookIntegration
# create a new task with custom data and an action definition
task = Task.create(
"task name",
data={
"custom": "data"
},
actions=[
Action("*/10%,success,error", integration=EmailIntegration(to="me@example.com")),
Action("cancelled", integration=WebhookIntegration(id="webhook:demo")),
]
)
# update the task status to 'processing' and set the value to 0
task.started()
try:
for i in range(100):
do_something(i)
if i!= 0 and i % 10 == 0:
# update the progress of the task
task.update_progress(i)
except Exception as e:
# record task errors
task.error(data={
"error": str(e)
})
raise
# record task success
task.success()
CLI USage
Configuration
$ taskbadger configure
Organization slug: my-org
Project slug: project-x
API Key: XYZ.ABC
Config written to ~/.config/taskbadger/config
Usage Examples
The CLI run
command executes your command whilst creating and updating a Task Badger task.
$ taskbadger run "demo task" --action error email to:me@test.com -- path/to/script.sh
Task created: https://taskbadger.net/public/tasks/xyz/
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
taskbadger-0.6.1.tar.gz
(22.7 kB
view hashes)
Built Distribution
taskbadger-0.6.1-py3-none-any.whl
(47.6 kB
view hashes)
Close
Hashes for taskbadger-0.6.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 62cdc6d0fb45ee8ed986d50d27766d87cce5e816d3a4723d3c8f74f6980fe7bf |
|
MD5 | 834afc9cd943f3523bf7c694bae89757 |
|
BLAKE2b-256 | 672923dd3f8bc7bfd109c8dcff8e8d359dd4dabc509969fbc40337544d9e8dc5 |