Skip to main content
The devhelm Python package provides both synchronous and asynchronous clients for the DevHelm API.

Install

pip install devhelm

Initialize

import os
from devhelm import DevHelm

client = DevHelm(api_token=os.environ["DEVHELM_API_TOKEN"])
For async usage:
from devhelm import AsyncDevHelm

client = AsyncDevHelm(api_token=os.environ["DEVHELM_API_TOKEN"])

Create a monitor

monitor = client.monitors.create(
    name="API Health",
    type="HTTP",
    config={"url": "https://api.example.com/health", "method": "GET"},
    frequency_seconds=60,
    regions=["us-east", "eu-west"],
)

print(f"Created monitor: {monitor.id}")

List monitors

monitors = client.monitors.list(page=0, size=50)

for monitor in monitors.data:
    print(f"{monitor.name}: {monitor.status}")

Get check results

results = client.monitors.check_results(monitor.id, limit=10)

for check in results.data:
    status = "✓" if check.passed else "✗"
    print(f"{check.region}: {status} ({check.response_time_ms}ms)")

Manage incidents

# List active incidents
incidents = client.incidents.list(status="CONFIRMED")

# Resolve an incident
client.incidents.resolve(incident_id)

Create an alert channel

channel = client.alert_channels.create(
    name="Slack Alerts",
    config={
        "channelType": "slack",
        "webhookUrl": os.environ["SLACK_WEBHOOK_URL"],
    },
)

Error handling

from devhelm.exceptions import DevHelmError, NotFoundError, RateLimitError

try:
    client.monitors.get("nonexistent-id")
except NotFoundError:
    print("Monitor not found")
except RateLimitError as e:
    print(f"Rate limited — retry after {e.retry_after}s")
except DevHelmError as e:
    print(f"{e.status}: {e.message}")

Async example

import asyncio
from devhelm import AsyncDevHelm

async def main():
    client = AsyncDevHelm(api_token=os.environ["DEVHELM_API_TOKEN"])

    monitors = await client.monitors.list()
    for monitor in monitors.data:
        results = await client.monitors.check_results(monitor.id, limit=1)
        latest = results.data[0] if results.data else None
        status = f"{latest.response_time_ms}ms" if latest else "no data"
        print(f"{monitor.name}: {status}")

asyncio.run(main())

Next steps

API Reference

Full endpoint reference with request/response schemas.

Error handling

Error response format and common scenarios.