Skip to main content

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


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.8.0.tar.gz (26.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

taskbadger-0.8.0-py3-none-any.whl (52.3 kB view details)

Uploaded Python 3

File details

Details for the file taskbadger-0.8.0.tar.gz.

File metadata

  • Download URL: taskbadger-0.8.0.tar.gz
  • Upload date:
  • Size: 26.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.9.18 Linux/6.2.0-1012-azure

File hashes

Hashes for taskbadger-0.8.0.tar.gz
Algorithm Hash digest
SHA256 bf5a07a8ac3a045036a9cc5149f06788cd5c120eff245e85f60132472e7b5bbc
MD5 aabad4e65d2ac1fc30f423e35559407d
BLAKE2b-256 a464eea240d352eef7d7aa72bbfd3a3089d69d753f402b476cb6b3947622afe7

See more details on using hashes here.

File details

Details for the file taskbadger-0.8.0-py3-none-any.whl.

File metadata

  • Download URL: taskbadger-0.8.0-py3-none-any.whl
  • Upload date:
  • Size: 52.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.9.18 Linux/6.2.0-1012-azure

File hashes

Hashes for taskbadger-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 628aaae481ab44b5181ace31cce07a0e5249e42c1deb093ef7ba4638b9e9e4d4
MD5 7e8477ef97a06a04162b52f5c66b2d1a
BLAKE2b-256 7d8b0d1921dc790fa91a5ea7ac2255bd0019ff55e7c64c3cf0f42f0552717ec4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page