Skip to content

Reference

Python API wrapper for Uptime Kuma.

UpdateException

Bases: Exception

Exception raised for errors fetching latest release from github.

UptimeKumaAuthenticationException

Bases: UptimeKumaException

Uptime Kuma authentication exception.

UptimeKumaConnectionException

Bases: UptimeKumaException

Uptime Kuma connection exception.

UptimeKumaException

Bases: Exception

Base Uptime Kuma exception.

MonitorStatus

Bases: IntEnum

Monitor states.

MonitorType

Bases: StrEnum

Monitors type.

UptimeKumaMonitor dataclass

Bases: UptimeKumaBaseModel

Monitor model for Uptime Kuma.

UptimeKumaVersion dataclass

Bases: UptimeKumaBaseModel

Uptime Kuma version.

UpdateChecker

Check for Uptime Kuma updates.

__init__

Initialize Uptime Kuma release checker.

latest_release async

Fetch latest IronOS release.

UptimeKuma

Uptime Kuma client.

__init__

Initialize the Uptime Kuma client.

Parameters:

Name Type Description Default
session ClientSession

An aiohttp ClientSession instance

required
base_url URL or str

The base URL of the Uptime Kuma server

required
api_key str or None

API key for authentication (default is None).

None
timeout float or None

Request timeout in seconds (default is 10 seconds if not specified).

None

metrics async

Retrieve metrics from Uptime Kuma.

Fetches and parses Prometheus-style metrics from the Uptime Kuma API endpoint, extracting monitor-related metrics and returning them as a dictionary of UptimeKumaMonitor objects keyed by monitor name.

Returns:

Type Description
dict[str, UptimeKumaMonitor]

A dictionary mapping monitor names to their corresponding UptimeKumaMonitor objects.

Raises:

Type Description
UptimeKumaAuthenticationException

If authentication with the Uptime Kuma API fails.

UptimeKumaConnectionException

If there is a connection error, timeout, or other client error during the request.