Upassist Python SDK & CLI
Official Python client library and CLI for the Upassist Monitoring, Uptime, Cron Heartbeats, Error Tracking & Observability Platform.
- Complete API Coverage: 100% of platform resources (Monitors, Heartbeats, Incidents, Maintenance, Error Apps, Status Pages, Dashboards, Members, API Keys, Logs, Metrics).
- Synchronous & Asynchronous: First-class
Upassist(sync) andAsyncUpassist(asyncio) clients with automatic connection pooling and retry transports. - Ergonomic Facades: High-level, pythonic interfaces (
client.monitors,client.heartbeats, etc.) with built-in pagination iterators (.iter()). - High-Throughput Ingest: Zero-latency helpers for cron heartbeats, structured log streaming, and metric collection.
- Bundled CLI: Full-featured
upassistcommand-line tool for bash scripts, crontab, and CI/CD pipelines.
Table of Contents
- Installation
- Authentication
- CLI Quickstart
- Practical Python Examples
- 1. Uptime Monitoring & Health Checks
- 2. Cron Job & Background Worker Monitoring (Heartbeats)
- 3. CI/CD Deployment: Alert Silencing via Maintenance Windows
- 4. Automated Incident Management
- 5. Sentry-Compatible Error Apps & Issue Tracking
- 6. High-Throughput Log & Metric Ingestion
- 7. Team Members & API Key Provisioning
- 8. Async / Asyncio Usage (FastAPI, Starlette, Quart)
- Error Handling
- License
Installation
pip install upassist
# or with uv
uv add upassist
# or with poetry
poetry add upassist
Authentication
Obtain your Project API Key from your Upassist Dashboard (Settings -> API Keys).
Pass your API key directly or export UPASSIST_API_KEY:
export UPASSIST_API_KEY="up_live_your_secret_api_key_here"
from upassist import Upassist
# If UPASSIST_API_KEY is exported, api_key argument is optional:
client = Upassist(api_key="up_live_your_secret_api_key_here")
CLI Quickstart
The package installs the upassist executable:
export UPASSIST_API_KEY="up_live_your_secret_api_key_here"
# 1. Verify credentials and project quota
upassist whoami
# 2. List monitors and check their status
upassist monitors list
upassist monitors get --id 12345
# 3. Ping cron heartbeats in crontab or bash
upassist heartbeats ping my-backup-job --status up --duration-ms 420 --msg "Backup successful"
# 4. View and acknowledge incidents
upassist incidents list
upassist incidents ack --id 98765
# 5. Create a deploy-time maintenance window
upassist maintenance create --name "v2.4.0 Deploy" --start "2026-11-21T21:00:00Z" --end "2026-11-21T21:30:00Z"
Practical Python Examples
1. Uptime Monitoring & Health Checks
Manage website and API endpoint monitors programmatically:
from upassist import Upassist
client = Upassist()
# 1. Create a new HTTP uptime monitor
new_monitor = client.monitors.create({
"name": "Production Payment Gateway",
"url": "https://api.example.com/health",
"monitor_type": "status",
"interval": 60, # Check every 60 seconds
"timeout": 10, # 10s timeout
"expected_status_code": 200,
"send_email": True,
"call": False,
})
print(f"Created monitor ID: {new_monitor.id}")
# 2. Iterate through all monitors across pages
for monitor in client.monitors.iter(per_page=50):
print(f"[{monitor.status.upper()}] {monitor.name} -> {monitor.url}")
# 3. Temporarily pause checks during maintenance
client.monitors.pause(new_monitor.id)
# 4. Resume checks
client.monitors.unpause(new_monitor.id)
2. Cron Job & Background Worker Monitoring (Heartbeats)
Never let a silent background task failure go unnoticed. Monitor Celery tasks, Kubernetes CronJobs, and system crontabs:
import time
from upassist import Upassist
client = Upassist()
def run_nightly_billing():
heartbeat_slug = "nightly-billing-cron"
start_time = time.time()
try:
# Perform your business logic...
print("Billing processing...")
time.sleep(1.5)
# Report success with duration
duration_ms = int((time.time() - start_time) * 1000)
client.heartbeats.ping(
token=heartbeat_slug,
status="up",
duration_ms=duration_ms,
message="Processed 14,205 invoices without error",
)
except Exception as exc:
# Report failure immediately to trigger on-call alerts
duration_ms = int((time.time() - start_time) * 1000)
client.heartbeats.ping(
token=heartbeat_slug,
status="down",
duration_ms=duration_ms,
message=f"Job crashed: {exc}",
)
raise
run_nightly_billing()
Reusable Context Manager / Decorator:
import contextlib
import time
from upassist import Upassist
client = Upassist()
@contextlib.contextmanager
def monitor_cron(token: str):
start = time.time()
try:
yield
duration = int((time.time() - start) * 1000)
client.heartbeats.ping(token=token, status="up", duration_ms=duration)
except Exception as exc:
duration = int((time.time() - start) * 1000)
client.heartbeats.ping(token=token, status="down", duration_ms=duration, message=str(exc))
raise
# Usage:
with monitor_cron("database-sync-worker"):
# Critical work here
pass
3. CI/CD Deployment: Alert Silencing via Maintenance Windows
Integrate into deploy scripts (Fabric, Ansible, GitHub Actions, GitLab CI) to silence alerts while services restart:
from datetime import datetime, timezone, timedelta
from upassist import Upassist
client = Upassist()
# 1. Schedule a 15-minute maintenance window starting right now
now = datetime.now(timezone.utc)
window_start = now.isoformat()
window_end = (now + timedelta(minutes=15)).isoformat()
window = client.maintenance.create({
"name": "Production Release v3.12.0",
"description": "Database migrations and rolling service restart",
"started_at": window_start,
"finished_at": window_end,
"timezone": "UTC",
"resources": [
# Silence all monitors or specific ones:
{"public_name": "API Service", "object_id": "101", "resource_type": "monitor"},
{"public_name": "Web Frontend", "object_id": "102", "resource_type": "monitor"},
],
})
print(f"Maintenance window #{window.id} active until {window_end}")
# 2. Deploy your code here...
# 3. If finished earlier, complete/delete window immediately:
client.maintenance.delete(window.id)
print("Maintenance window ended, alerting resumed.")
4. Automated Incident Management
Inspect active outages and programmatically acknowledge or resolve them:
from upassist import Upassist
client = Upassist()
# Fetch open incidents
incidents = client.incidents.list(page=1, per_page=20)
for incident in incidents.items:
print(f"Incident #{incident.id}: {incident.cause} (State: {incident.state})")
# Acknowledge incident to stop escalation escalation alerts
if incident.state == "started":
client.incidents.ack(incident.id)
print(f" -> Acknowledged #{incident.id}")
# Auto-resolve incident after automated remediation
# client.incidents.resolve(incident.id)
5. Sentry-Compatible Error Apps & Issue Tracking
Upassist includes a built-in Sentry-compatible error collection and crash reporting service. You can audit, query, and resolve error issues:
from upassist import Upassist
client = Upassist()
# 1. List error tracking apps
apps = client.error_apps.list()
for app in apps:
print(f"App: {app.name} | Sentry DSN: {app.sentry_dsn}")
# 2. Inspect active issues for an app
if apps:
app_id = apps[0].id
issues = client.error_apps.issues.list(app_id=app_id)
for issue in issues.items:
print(f"Issue: {issue.title} (Seen {issue.events_count} times)")
# Resolve issue after deploying fix:
client.error_apps.issues.resolve(app_id=app_id, issue_id=issue.id)
6. High-Throughput Log & Metric Ingestion
Push structured logs and custom metrics directly to Upassist telemetry ingestion servers:
from datetime import datetime, timezone
from upassist import Upassist
client = Upassist()
# Ingest structured application logs
client.logs.collect(
service="checkout-service",
logs=[
{
"level": "INFO",
"message": "Payment intent succeeded",
"timestamp": datetime.now(timezone.utc).isoformat(),
"context": {
"customer_id": "cust_9921",
"amount": 149.99,
"currency": "USD",
},
},
],
)
# Ingest custom timeseries metrics
client.metrics.collect(
metrics=[
{
"name": "cart_checkout_seconds",
"value": 1.24,
"type": "gauge",
"labels": {"region": "us-east-1", "env": "prod"},
},
{
"name": "active_websocket_connections",
"value": 450,
"type": "gauge",
},
]
)
7. Team Members & API Key Provisioning
Automate user onboarding and machine-to-machine API key rotation:
from upassist import Upassist
client = Upassist()
# 1. List current project team members
members = client.members.list()
for m in members:
print(f"Member: {m.email} (Role: {m.role})")
# 2. Invite a new team member
client.invitations.create({
"email": "devops@company.com",
"role": "admin",
})
# 3. Create a scoped API key for CI/CD runners
key = client.api_keys.create({
"name": "GitHub Actions Deployment Key",
"scopes": [
"monitor:read",
"maintenance:write",
"heartbeat:write",
],
})
print(f"Generated Key: {key.token}")
8. Async / Asyncio Usage (FastAPI, Starlette, Quart)
Use AsyncUpassist with async/await for high-concurrency applications:
import asyncio
from upassist import AsyncUpassist
async def main():
async with AsyncUpassist(api_key="up_live_secret") as client:
# Run queries concurrently
monitors_task = client.monitors.list()
heartbeats_task = client.heartbeats.list()
incidents_task = client.incidents.list()
monitors, heartbeats, incidents = await asyncio.gather(
monitors_task, heartbeats_task, incidents_task
)
print(f"Monitors: {len(monitors.items)}")
print(f"Heartbeats: {len(heartbeats.items)}")
print(f"Incidents: {len(incidents.items)}")
if __name__ == "__main__":
asyncio.run(main())
Error Handling
All management API failures raise APIError with structured code, human-readable message, and request ID for debugging:
from upassist import Upassist, APIError
client = Upassist()
try:
client.monitors.get(monitor_id="non-existent-id")
except APIError as err:
print(f"Code: {err.code}") # e.g., 'not_found'
print(f"Message: {err.message}") # e.g., 'Monitor with id ... was not found'
print(f"Request ID: {err.request_id}") # e.g., 'req_01hqb7...'
License
This project is licensed under the MIT License. See LICENSE for details.
Metadata
Release files for upassist 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| upassist-1.0.0.tar.gz | 133.6 kB | Without provenance | Details for upassist-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| upassist-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for upassist-1.0.0-py3-none-any.whl |
Total release size: 517.5 kB
Release files / upassist-1.0.0.tar.gz
| Download URL | upassist-1.0.0.tar.gz |
|---|---|
| Size | 133.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d0b0b31b6ec2a55b4079d147fa66c415dd9801746f361af5e361072d067ec043
|
|
BLAKE2b-256 checksum How to use checksums |
b3424e784a249a38c4f69aa535e9a8174df8c180aaf3cc2e9fbc376648dc26cb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / upassist-1.0.0-py3-none-any.whl
| Download URL | upassist-1.0.0-py3-none-any.whl |
|---|---|
| Size | 383.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7e8a6e400c387fe9dc28f4703564fb53fc8c5c8199263b47022c262f02827158
|
|
BLAKE2b-256 checksum How to use checksums |
5805d330123672494ec3a83df0ecb089500cdf3b651143100d38e4e576aad7ee
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for upassist 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.