Official Python client for Whycron — cron job monitoring that tells you why.
Project description
whycron — Python client for Whycron
Cron job monitoring that tells you why. This is the official Python SDK.
pip install whycron-sdk
The pip-install name is whycron-sdk (PyPI), but you import it as whycron:
from whycron import Whycron, monitor
Heartbeat pings
The ping token is the credential — no API key needed.
from whycron import Whycron
client = Whycron()
client.ping("wcr_abc123def", state="started")
try:
do_the_work()
client.ping("wcr_abc123def", state="succeeded", duration_ms=1234)
except Exception as exc:
client.ping("wcr_abc123def", state="failed", exit_code=1, logs=str(exc))
raise
Decorator
For most jobs, this is all you need:
import whycron
@whycron.monitor("wcr_abc123def")
def nightly_backup():
...
Sends a started ping before the function runs, then succeeded (with exit_code=0 and duration_ms) on a clean return, or failed (with exit_code=1, duration_ms, and the traceback tail as logs) if it raises. The exception still propagates after the ping is sent.
Network errors during the ping never break the wrapped function — they're logged via the standard library logging module under the whycron logger.
Programmatic management (API key required)
Get a key from your dashboard at Account → API keys. Then:
from whycron import Whycron
client = Whycron(api_key="wcr_live_...")
monitor = client.create_monitor(
name="Nightly Backup",
schedule_type="cron",
schedule_value="0 2 * * *",
grace_period_seconds=120,
)
monitors = client.list_monitors(status="failing")
client.update_monitor(monitor["id"], paused=True)
client.delete_monitor(monitor["id"])
runs = client.list_runs(monitor_id=monitor["id"])
run = client.get_run(runs["items"][0]["id"])
Scope-gated routes obey your key's scopes:
| Method | Scope needed |
|---|---|
list_monitors, get_monitor |
monitors:read |
create_monitor, update_monitor, delete_monitor |
monitors:write |
list_runs, get_run |
runs:read |
A WhycronAuthError (401) means the key is missing, malformed, or revoked. A WhycronAPIError with .status_code == 403 means the key is valid but lacks the scope.
Errors
| Exception | When |
|---|---|
WhycronAuthError |
401 — bad/missing/revoked key |
WhycronNotFoundError |
404 — wrong ID, or resource in another org |
WhycronRateLimitedError |
429 — slow down |
WhycronAPIError |
any other non-2xx |
WhycronError |
base class of all of the above |
Self-hosted / staging
client = Whycron(api_key="...", base_url="https://api.staging.example.com")
License
MIT.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file whycron_sdk-0.1.0.tar.gz.
File metadata
- Download URL: whycron_sdk-0.1.0.tar.gz
- Upload date:
- Size: 7.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4854ff8eec299f5e8ac4891b7b4d0cf58401ebef397010ed828b7e2fe0270e40
|
|
| MD5 |
c770ad2b482a8c7c4cb672f24d279a4b
|
|
| BLAKE2b-256 |
8723a50f76dfaef04bcef8af9ca2104e33dee60c1c88674b8dac227253fd7084
|
Provenance
The following attestation bundles were made for whycron_sdk-0.1.0.tar.gz:
Publisher:
publish-python-sdk.yml on Saksham1367/Whycron
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
whycron_sdk-0.1.0.tar.gz -
Subject digest:
4854ff8eec299f5e8ac4891b7b4d0cf58401ebef397010ed828b7e2fe0270e40 - Sigstore transparency entry: 1566460735
- Sigstore integration time:
-
Permalink:
Saksham1367/Whycron@6d04b94bde7415e4db824a1acee90dd74c5f5eed -
Branch / Tag:
refs/tags/sdk-py-v0.1.0 - Owner: https://github.com/Saksham1367
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-python-sdk.yml@6d04b94bde7415e4db824a1acee90dd74c5f5eed -
Trigger Event:
push
-
Statement type:
File details
Details for the file whycron_sdk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: whycron_sdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
74d45c74c04498276074f8af0f836e5fdf260da733a50f492a3db8e146f348db
|
|
| MD5 |
2623a5acc000fcb774b58345f3808aa1
|
|
| BLAKE2b-256 |
e6837098bebe838c36a61d5b6e1ea280a7b3cd76e8968d4dac722bebfe112aa2
|
Provenance
The following attestation bundles were made for whycron_sdk-0.1.0-py3-none-any.whl:
Publisher:
publish-python-sdk.yml on Saksham1367/Whycron
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
whycron_sdk-0.1.0-py3-none-any.whl -
Subject digest:
74d45c74c04498276074f8af0f836e5fdf260da733a50f492a3db8e146f348db - Sigstore transparency entry: 1566460763
- Sigstore integration time:
-
Permalink:
Saksham1367/Whycron@6d04b94bde7415e4db824a1acee90dd74c5f5eed -
Branch / Tag:
refs/tags/sdk-py-v0.1.0 - Owner: https://github.com/Saksham1367
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-python-sdk.yml@6d04b94bde7415e4db824a1acee90dd74c5f5eed -
Trigger Event:
push
-
Statement type: