Pingera SDK
A comprehensive Python SDK for the Pingera monitoring platform API, built using OpenAPI Generator for full type safety and complete API coverage.
Features
- Complete API Coverage: Auto-generated from the official OpenAPI specification
- Type Safety: Full type hints and Pydantic model validation
- Easy Authentication: Support for Bearer tokens and API keys
- Comprehensive: All Pingera API endpoints supported:
- Status Pages Management
- Status Pages (Components & Incidents)
- Monitoring Checks
- Heartbeats
- Alerts
- On-demand Checks
- Unified Results
Installation
pip install pingera-sdk
Or install from source:
git clone https://github.com/pingera/pingera-sdk.git
cd pingera-sdk
pip install -e .
Quick Start
Authentication
Set your API token via environment variable:
export PINGERA_API_KEY="your_api_token"
Basic Usage
from pingera import ApiClient, Configuration
from pingera.api import ChecksApi, StatusPagesComponentsApi
# Configure the client
configuration = Configuration()
configuration.host = "https://api.pingera.ru"
configuration.api_key['apiKeyAuth'] = "your_api_token"
# Create API client
with ApiClient(configuration) as api_client:
# Initialize API instances
checks_api = ChecksApi(api_client)
components_api = StatusPagesComponentsApi(api_client)
# List status pages
status_pages_api = StatusPagesApi(api_client)
pages = status_pages_api.v1_pages_get()
print(f"Found {len(pages.data)} status pages")
# List monitoring checks
checks = checks_api.v1_checks_get(page=1, page_size=10)
print(f"Found {len(checks.checks)} checks")
# List components for a status page
components = components_api.v1_pages_page_id_components_get("your_page_id")
print(f"Found {len(components.data)} components")
Available APIs
The SDK provides access to all Pingera API endpoints through these API classes:
from pingera.api import (
StatusPagesApi, # Manage status pages
StatusPagesComponentsApi, # Manage status page components
StatusPagesIncidentsApi, # Manage incidents and maintenance
ChecksApi, # Manage monitoring checks
AlertsApi, # Manage alerts and notifications
HeartbeatsApi, # Manage heartbeat monitoring
OnDemandChecksApi, # Execute checks on-demand
ChecksUnifiedResultsApi # Get unified check results
)
Working with Models
All API requests and responses use typed Pydantic models:
from pingera.models import (
Component,
IncidentCreate,
IncidentUpdateCreate,
ExecuteCustomCheckRequest
)
# Create a new component
new_component = Component(
name="API Server",
description="Main API endpoint",
status="operational"
)
# Create an incident
new_incident = IncidentCreate(
name="Database Connectivity Issues",
body="We are investigating connectivity issues",
status="investigating",
impact="major"
)
Examples
Check the examples/ directory for comprehensive usage examples:
basic_usage.py- Basic client setup and operationsstatus_pages_management.py- Status pages CRUD operationscomponent_management.py- Component CRUD operationsincident_management.py- Incident and maintenance managementcomprehensive_sdk_usage.py- Comprehensive API demonstrationon_demand_synthetic_check.py- Execute synthetic check with playwright script and get the result
Configuration
Environment Variables
| Variable | Description |
|---|---|
PINGERA_API_KEY |
Your Pingera API token |
PINGERA_PAGE_ID |
Default page ID for status page operations |
Manual Configuration
from pingera import Configuration
configuration = Configuration()
configuration.host = "https://api.pingera.ru"
# API token authentication
configuration.api_key['apiKeyAuth'] = "your_api_token"
# Optional: configure timeouts, retries, etc.
configuration.timeout = 30
Error Handling
The SDK uses proper exception handling:
from pingera.exceptions import ApiException
try:
checks = checks_api.v1_checks_get()
except ApiException as e:
print(f"API Error [{e.status}]: {e.reason}")
if e.body:
print(f"Details: {e.body}")
Development
Regenerating the Client
If the Pingera API specification changes, you can regenerate the client:
# Install the OpenAPI generator
pip install openapi-generator-cli[jdk4py]
# Regenerate the client
python generate_client.py
Running Tests
pip install -e ".[dev]"
pytest
Running Examples
# Set your credentials
export PINGERA_API_KEY="your_api_token"
export PINGERA_PAGE_ID="your_page_id"
# Run examples
python examples/basic_usage.py
python examples/component_management.py
python examples/incident_management.py
API Documentation
For detailed API documentation, visit:
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Run the test suite
- Submit a pull request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
- 📧 Email: privet@pingera.ru
- 📖 Documentation: docs.pingera.ru
- 🌐 Website: pingera.ru
- 📊 Status: status.pingera.ru
Links
Metadata
Release files for pingera-sdk 1.0.15
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pingera_sdk-1.0.15.tar.gz | 170.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pingera_sdk-1.0.15-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 656.2 kB
Release files / pingera_sdk-1.0.15.tar.gz
| Download URL | pingera_sdk-1.0.15.tar.gz |
|---|---|
| Size | 170.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
507d7bf2b048efb7c4bd272dd0c8b3d4a12fe65531ed9f3028fa2a3bba87f00d
|
|
BLAKE2b-256 checksum How to use checksums |
4abfe481027b0783fcd8d280f34354b4bd2ba4b800831bf788db26ced5103b48
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.5
|
Release files / pingera_sdk-1.0.15-py3-none-any.whl
| Download URL | pingera_sdk-1.0.15-py3-none-any.whl |
|---|---|
| Size | 485.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
75cb4cda2aa9616a7a1f1714789f20468f1e6fe1755a9e8c22f85220d966c88d
|
|
BLAKE2b-256 checksum How to use checksums |
279c413045474339aeed4090b552318171ed3b93e4f35db1cb43b15db3de6d02
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.5
|