Metadata-Version: 2.4
Name: beatwatch
Version: 0.1.0
Summary: Tiny client for the BeatWatch dead-man's-switch monitor for cron and Celery jobs.
Author-email: Surajit Das <surajit.das0320@gmail.com>
License: MIT
Project-URL: Homepage, https://beatwatch.dev
Project-URL: Documentation, https://beatwatch.dev/docs/
Project-URL: Source, https://github.com/surajit003/BeatWatch
Project-URL: Issues, https://github.com/surajit003/BeatWatch/issues
Keywords: monitoring,cron,celery,dead-mans-switch,healthcheck,uptime
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: System :: Monitoring
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Provides-Extra: celery
Requires-Dist: celery>=5; extra == "celery"

# beatwatch

Tiny client for [BeatWatch](https://beatwatch.example.com) — the dead-man's-switch monitor for scheduled jobs.

## Install

```bash
pip install beatwatch
# optional: pip install beatwatch[celery]
```

## Usage

```python
from beatwatch import ping, set_base_url

set_base_url("https://your-beatwatch.example.com")

def nightly_report():
    do_the_work()
    ping("<TOKEN>")  # non-blocking, never raises
```

Set `BEATWATCH_BASE_URL` env var instead of calling `set_base_url`, if you prefer.

### Celery

```python
from beatwatch.celery import monitored_task

@monitored_task("<TOKEN>")
def cleanup_old_records():
    OldRecord.objects.filter(stale=True).delete()
```

The ping is only emitted when the wrapped task returns successfully — failures don't ping, so missed pings really mean "the job didn't finish."
