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.0.tar.gz (72.1 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.0-py3-none-any.whl (52.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: oack-0.2.0.tar.gz
  • Upload date:
  • Size: 72.1 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.0.tar.gz
Algorithm Hash digest
SHA256 24a1dd3cf25347d978c36668e64d536995b764ed7be03b785ac7d8110d966dc3
MD5 a9df4b5388ea25cf92a157c0b147193a
BLAKE2b-256 ce0c0a3fde0fcd299d89869c05296c0a5bed092a0b28e095ceaf1d850a144a70

See more details on using hashes here.

Provenance

The following attestation bundles were made for oack-0.2.0.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.0-py3-none-any.whl.

File metadata

  • Download URL: oack-0.2.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a74bcafca7df06c266e40d0376c92ae17b67d2baeb768ddfafc1540099c74280
MD5 f1dbb22458de615c791e69cc0d00ec12
BLAKE2b-256 e5f975f7744053714f5e889c3bfb5e56f3dc08c700cedb14f92f2f7726f1341b

See more details on using hashes here.

Provenance

The following attestation bundles were made for oack-0.2.0-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