Skip to main content

Official Python client for the Oack monitoring API

Project description

PyPI version Python versions CI License: MPL 2.0 Checked with mypy Ruff

oack

Official Python client for the Oack monitoring API.

Installation

Note: PyPI publishing is temporarily unavailable. Install directly from GitHub:

pip install git+https://github.com/oack-io/oack-python.git

# or pin to a specific version
pip install git+https://github.com/oack-io/oack-python.git@v0.1.0

In requirements.txt:

oack @ git+https://github.com/oack-io/oack-python.git@v0.1.0

In pyproject.toml (PEP 621):

dependencies = [
    "oack @ git+https://github.com/oack-io/oack-python.git@v0.1.0",
]

Once published to PyPI, the standard install will work:

pip install oack

Quick Start

Async (recommended)

from oack import AsyncOack

async with AsyncOack(api_key="sk-...") as client:
    teams = await client.teams.list()
    for team in teams:
        print(team.id, team.name)

Sync

from oack import Oack

with Oack(api_key="sk-...") as client:
    teams = client.teams.list()
    for team in teams:
        print(team.id, team.name)

Configuration

client = AsyncOack(
    api_key="sk-...",
    base_url="https://api.oack.io",  # default
    timeout=30.0,                     # seconds, default
    max_retries=2,                    # default
)

# Dynamic token (e.g. refreshable JWT)
client = AsyncOack(api_key_func=lambda: get_current_jwt())

Browser Login (Device Flow)

Authenticate via browser instead of a static API key. The JWT lives only in memory and disappears when the program exits.

from oack import Oack, device_flow_authenticate

# Opens your browser, waits for approval, returns JWT
token = device_flow_authenticate()

with Oack(api_key=token) as client:
    teams = client.teams.list()

Async version:

from oack import AsyncOack, async_device_flow_authenticate

token = await async_device_flow_authenticate()

async with AsyncOack(api_key=token) as client:
    teams = await client.teams.list()

Error Handling

from oack import AsyncOack, NotFoundError, RateLimitError, APIError

try:
    monitor = await client.monitors.get(team_id, monitor_id)
except NotFoundError:
    print("Monitor not found")
except RateLimitError as e:
    print(f"Rate limited, retry after {e.retry_after}s")
except APIError as e:
    print(f"API error {e.status_code}: {e.message}")

Resources

Resource Access Key Methods
Accounts client.accounts create, list, get, update, delete, restore, transfer
Teams client.teams create, list, get, update, delete, list_members, add_member
Monitors client.monitors create, list, get, update, delete, pause, unpause, duplicate, move
Probes client.probes list, get, get_details, download_pcap, aggregate
Alert Channels client.alert_channels create, list, get, update, delete, test
Metrics client.metrics get_monitor_metrics, get_expiration, list_timeline, chart events
Geo client.geo list_checkers, list_regions

Types

All response types are Pydantic v2 models with full IDE autocomplete:

from oack.types import Monitor, Team, Probe, CreateMonitorParams

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

oack-0.2.1.tar.gz (72.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

oack-0.2.1-py3-none-any.whl (52.1 kB view details)

Uploaded Python 3

File details

Details for the file oack-0.2.1.tar.gz.

File metadata

  • Download URL: oack-0.2.1.tar.gz
  • Upload date:
  • Size: 72.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for oack-0.2.1.tar.gz
Algorithm Hash digest
SHA256 27ad9dfa6f28c4229f06572340ecdaa739dba816fba27c8eb2b079039e0d3eca
MD5 f0b5017a0cebfaeedbe3ec0d8d4f1219
BLAKE2b-256 bfe764d6f56090ad023fe8619b408fc7ea15d0f3fbaccdf630494e06e2fc45c9

See more details on using hashes here.

Provenance

The following attestation bundles were made for oack-0.2.1.tar.gz:

Publisher: publish.yml on oack-io/oack-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file oack-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: oack-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 52.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for oack-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 18da950a7329549460db3cfd1ae933ff7f343994035fcf4aa1af1f6a4dcc4d96
MD5 7b309867ebda1c2b4e2e784a169495a1
BLAKE2b-256 069c28f78336a3f11da82089f631cdec7ff830ba8ff296f9d1a36de996c9a71f

See more details on using hashes here.

Provenance

The following attestation bundles were made for oack-0.2.1-py3-none-any.whl:

Publisher: publish.yml on oack-io/oack-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page