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.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| opsduty_python-0.3.0.tar.gz | 14.2 kB | Without provenance | Details for opsduty_python-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| opsduty_python-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for opsduty_python-0.3.0-py3-none-any.whl |
Total release size: 34.0 kB
Release files / opsduty_python-0.3.0.tar.gz
| Download URL | opsduty_python-0.3.0.tar.gz |
|---|---|
| Size | 14.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c445a1383dc3949392f5e719090a456a3f5dcb3d47a62231c66286b60f9bad88
|
|
BLAKE2b-256 checksum How to use checksums |
39544209df8207fd00ce54eba670e3ebcb78d6de22865254d2314c9187548ddb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.5.1 CPython/3.14.4 Linux/7.0.0-1019-azure
|
Release files / opsduty_python-0.3.0-py3-none-any.whl
| Download URL | opsduty_python-0.3.0-py3-none-any.whl |
|---|---|
| Size | 19.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
db96520024e71bad4e0d29e815d83f3eba67492b3c7d7b384720953486250ffe
|
|
BLAKE2b-256 checksum How to use checksums |
77e3ca4c861f7446b18af93c2764be9b5c06a8a82394457820b55ad70bc2c2f0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.5.1 CPython/3.14.4 Linux/7.0.0-1019-azure
|
Security for opsduty-python 0.3.0
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.