Skip to main content

Python SDK for the Pingera monitoring platform API

Project description

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:

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

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Run the test suite
  6. Submit a pull request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

Links

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

pingera_sdk-1.0.4.tar.gz (108.8 kB view details)

Uploaded Source

Built Distribution

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

pingera_sdk-1.0.4-py3-none-any.whl (258.5 kB view details)

Uploaded Python 3

File details

Details for the file pingera_sdk-1.0.4.tar.gz.

File metadata

  • Download URL: pingera_sdk-1.0.4.tar.gz
  • Upload date:
  • Size: 108.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.11

File hashes

Hashes for pingera_sdk-1.0.4.tar.gz
Algorithm Hash digest
SHA256 3136eafebc45ff6b7ea92fef4739b3c91532e3b0eda1e14a00769d506d211ff3
MD5 0ff7286da4750d0cdd53dc1f72d03513
BLAKE2b-256 7eee4d07eb61ca1bc153eaed0170d827a8d348c9e938150f058d83a5b6eb7cbc

See more details on using hashes here.

File details

Details for the file pingera_sdk-1.0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for pingera_sdk-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 985172fafb9bf2dbde23dc9aaee4f8561aab8c9df9d5cd0db08e6c6bf3a49627
MD5 c88166990abe2b21566a55cd37704e0a
BLAKE2b-256 be5b10bec49b70ff755038a04d1d0f4d94c12f6a5117a7d88347d980c3270806

See more details on using hashes here.

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