Official Python client for the Oack monitoring API
Project description
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
27ad9dfa6f28c4229f06572340ecdaa739dba816fba27c8eb2b079039e0d3eca
|
|
| MD5 |
f0b5017a0cebfaeedbe3ec0d8d4f1219
|
|
| BLAKE2b-256 |
bfe764d6f56090ad023fe8619b408fc7ea15d0f3fbaccdf630494e06e2fc45c9
|
Provenance
The following attestation bundles were made for oack-0.2.1.tar.gz:
Publisher:
publish.yml on oack-io/oack-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
oack-0.2.1.tar.gz -
Subject digest:
27ad9dfa6f28c4229f06572340ecdaa739dba816fba27c8eb2b079039e0d3eca - Sigstore transparency entry: 1270547900
- Sigstore integration time:
-
Permalink:
oack-io/oack-python@a7371e6ba7e444069dcb63ee736c99e61ba7ae4b -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/oack-io
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a7371e6ba7e444069dcb63ee736c99e61ba7ae4b -
Trigger Event:
push
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
18da950a7329549460db3cfd1ae933ff7f343994035fcf4aa1af1f6a4dcc4d96
|
|
| MD5 |
7b309867ebda1c2b4e2e784a169495a1
|
|
| BLAKE2b-256 |
069c28f78336a3f11da82089f631cdec7ff830ba8ff296f9d1a36de996c9a71f
|
Provenance
The following attestation bundles were made for oack-0.2.1-py3-none-any.whl:
Publisher:
publish.yml on oack-io/oack-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
oack-0.2.1-py3-none-any.whl -
Subject digest:
18da950a7329549460db3cfd1ae933ff7f343994035fcf4aa1af1f6a4dcc4d96 - Sigstore transparency entry: 1270547901
- Sigstore integration time:
-
Permalink:
oack-io/oack-python@a7371e6ba7e444069dcb63ee736c99e61ba7ae4b -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/oack-io
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a7371e6ba7e444069dcb63ee736c99e61ba7ae4b -
Trigger Event:
push
-
Statement type: