Skip to main content

opsduty-python

Command-line utility for interfacing with OpsDuty.

The opsduty-python library is built with two core features in mind:

  • Command-line interface to interact with OpsDuty
  • Programmatic way to report heartbeat checkins in Python

Help

See the documentation for more details.

CLI

The opsduty-python package contains a CLI that can be used to interact with OpsDuty.

The preferred way to install the CLI is to use pipx install opsduty-python.

$ opsduty
Usage: opsduty [OPTIONS] COMMAND [ARGS]...

Options:
  --log-format [json|logfmt|console]
                                  [default: console]
  --log-level [error|warning|info|debug]
                                  [default: info]
  --base-url TEXT                 Base URL for API requests to OpsDuty.
  --timeout INTEGER               API request timeout to OpsDuty.  [required]
  --access-token TEXT             Set the bearer token used to communicate
                                  with OpsDuty.  [env var:
                                  OPSDUTY_ACCESS_TOKEN]
  --version                       Show the version and exit.
  -h, --help                      Show this message and exit.

Commands:
  heartbeats  Commands for managing and monitoring heartbeats.
  schedules   Commands for accessing schedules.

  Command-line utility for interfacing with OpsDuty.

Heartbeats

Send periodic heartbeats to OpsDuty using opsduty-python. The heartbeat needs to be configured in OpsDuty before check-ins can be observed. Head over to https://opsduty.io to configure your heartbeats.

Installation

Install using pip install -U opsduty-python.

Alternative 1: Decorator

from opsduty_python.heartbeats.heartbeats import (
    heartbeat_checkin,
)

@heartbeat_checkin(heartbeat="HBXXXX", environment="prod", enabled=True)
def periodic_job():
    pass

Alternative 2: Send heartbeat manually.

from opsduty_python.heartbeats.heartbeats import (
    send_heartbeat_checkin,
)

def periodic_job():
    try:
        pass
    except Exception:
        print("Job failed.")
    else:
        send_heartbeat_checkin(heartbeat="HBXXXX", environment="prod")

Metadata

Release files for opsduty-python 0.2.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for opsduty-python 0.2.6
File Size Uploaded Provenance Actions
opsduty_python-0.2.6.tar.gz 14.9 kB Without provenance Details for opsduty_python-0.2.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for opsduty-python 0.2.6
File Interpreter ABI Platform Actions
opsduty_python-0.2.6-py3-none-any.whl Python 3 none any Details for opsduty_python-0.2.6-py3-none-any.whl

Total release size: 34.6 kB

Release files / opsduty_python-0.2.6.tar.gz

Download URL opsduty_python-0.2.6.tar.gz
Size 14.9 kB
Tags Source
SHA-256 checksum
How to use checksums
1160a06cc0a96fe7fdc36a7ee662c2ff1b42cfe97491e53e1bc24628fd52a397
BLAKE2b-256 checksum
How to use checksums
6028f8e46ff1e56893ac548158c0b117cdc6cc6bb87b8d9d2d7f7be7b0bcb1b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.12.3 Linux/6.17.0-1022-azure

Release files / opsduty_python-0.2.6-py3-none-any.whl

Download URL opsduty_python-0.2.6-py3-none-any.whl
Size 19.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9304b6f26e817c6a111c744d88b4a5a880048d22c7dd45dcc850607cc9b03b8c
BLAKE2b-256 checksum
How to use checksums
7e52cb3c6d04bd29a981095ad6b74e02fbba32f9532fd95ec19f2c70bdcc9987
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.12.3 Linux/6.17.0-1022-azure

Security for opsduty-python 0.2.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page