Metadata-Version: 2.4
Name: watchfor
Version: 0.1.0
Summary: Official Python SDK + CLI for WatchFor — uptime & infrastructure monitoring (monitors, alert rules, incidents, maintenance windows) over the REST API.
Author-email: WatchFor <hello@watchfor.io>
License: MIT
Project-URL: Homepage, https://watchfor.io/docs/api
Project-URL: Documentation, https://watchfor.io/docs/api
Project-URL: Source, https://www.npmjs.com/package/watchfor
Project-URL: Bug Reports, https://watchfor.io/docs/api
Keywords: watchfor,monitoring,uptime,sdk,cli,incidents,status-page,mcp
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: System :: Monitoring
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# watchfor (Python)

Official Python SDK + CLI for [WatchFor](https://watchfor.io) — uptime &
infrastructure monitoring (monitors, alert rules, incidents, maintenance
windows) over the REST API. Zero dependencies (standard library only).

There is also a [TypeScript SDK](https://www.npmjs.com/package/watchfor),
an [MCP server](https://watchfor.io/docs/api/mcp) and an
[A2A agent](https://watchfor.io/docs/api/a2a) for AI agents.

## Install

```bash
pip install watchfor
```

## Quick start

```python
from watchfor import WatchFor

wf = WatchFor(api_key="wf_live_...")  # create keys in Settings → API keys

# One-call org snapshot
print(wf.summary())

# List monitors
for m in wf.monitors.list()["data"]:
    print(m["name"], m["status"])

# Create a monitor (idempotency key optional, for safe retries)
mon = wf.monitors.create(
    {
        "name": "example.com",
        "type": "http",
        "target": "https://example.com",
        "interval": 300,
        "locations": ["<location-id>"],  # from wf.locations()
    },
    idempotency_key="create-example-1",
)

# Diagnose: firing incidents right now
for inc in wf.incidents.list(status="firing")["data"]:
    print(inc["message"], inc["severity"])
```

Resource namespaces: `wf.monitors`, `wf.alert_rules`, `wf.incidents`,
`wf.maintenance_windows`, `wf.contacts`, `wf.contact_groups`. Top-level:
`wf.summary()`, `wf.plan()`, `wf.me()`, `wf.locations()`, `wf.monitor_types()`,
`wf.incident_stats(period=...)`, `wf.notifications(...)`, `wf.activity(...)`.

Errors raise `WatchForError` with `.status`, `.code` and `.message`.

## CLI

```bash
export WATCHFOR_API_KEY=wf_live_...
watchfor summary
watchfor monitors
watchfor incidents --status firing
watchfor checks <monitor_id>
```

## Auth & scopes

Keys carry a scope: `read` (all GET endpoints) or `write` (read plus
create/update/delete). See
[authentication](https://watchfor.io/docs/api/authentication). The API is also
reachable via OAuth 2.1 for MCP clients.

## Reference

- OpenAPI spec: <https://watchfor.io/openapi.json>
- Guides: <https://watchfor.io/docs/api>

MIT License.
