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

# 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")
        )
    ]
)

# 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.4.4.tar.gz (21.6 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.4.4-py3-none-any.whl (46.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: taskbadger-0.4.4.tar.gz
  • Upload date:
  • Size: 21.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.0 CPython/3.9.16 Linux/5.15.0-1037-azure

File hashes

Hashes for taskbadger-0.4.4.tar.gz
Algorithm Hash digest
SHA256 86fb32a04f58530a8ae0f26401810d30850e7884835b1ea671d660af3ca9b453
MD5 ffa1f13e4644bc4acf98d297dc0f9030
BLAKE2b-256 3b70fbab5c631b006d6affbb1a530d37d575824de43e4f248fb612f846674b7b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: taskbadger-0.4.4-py3-none-any.whl
  • Upload date:
  • Size: 46.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.0 CPython/3.9.16 Linux/5.15.0-1037-azure

File hashes

Hashes for taskbadger-0.4.4-py3-none-any.whl
Algorithm Hash digest
SHA256 c387ba4eb6e7af50cea23f2df61f74f514573d2a220e088a03f5d370945f29e8
MD5 9b45b74930614c63871a680dfc37107a
BLAKE2b-256 7fe0a23876e819e9de92355e1de2d50410f4bbd4e37817a2a2a8096e9870c5ab

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