API Reference¶
Complete API reference for the Kibana Python client.
This section provides detailed documentation for all public classes, methods, and exceptions in the kibana-py library. The documentation is automatically generated from code docstrings and includes usage examples.
Client Classes
Namespace Clients
Error Handling
Overview¶
The Kibana Python client provides both synchronous and asynchronous interfaces for interacting with Kibana’s REST API. The client is organized into namespace clients that group related functionality:
Main Clients¶
Kibana- Synchronous client for Kibana APIAsyncKibana- Asynchronous client for Kibana APISpaceScopedKibana- Space-scoped synchronous clientAsyncSpaceScopedKibana- Space-scoped asynchronous client
Namespace Clients¶
ActionsClient- Manage action connectorsSpacesClient- Manage Kibana SpacesSavedObjectsClient- Manage saved objectsStatusClient- Monitor server health
Exception Classes¶
KibanaException- Base exception classApiError- API-level errorsTransportError- Transport-level errorsSpaceError- Space-related errors
Quick Start¶
Synchronous Client¶
from kibana import Kibana
# Initialize client
client = Kibana(
"http://localhost:5601",
api_key="your_api_key"
)
# Use namespace clients
status = client.status.get_status()
connectors = client.actions.get_all()
spaces = client.spaces.get_all()
# Close client
client.close()
Asynchronous Client¶
from kibana import AsyncKibana
import asyncio
async def main():
# Initialize async client
async with AsyncKibana("http://localhost:5601") as client:
# Use namespace clients with await
status = await client.status.get_status()
connectors = await client.actions.get_all()
spaces = await client.spaces.get_all()
asyncio.run(main())
Space-Scoped Operations¶
from kibana import Kibana
client = Kibana("http://localhost:5601")
# Create space-scoped client
marketing_client = client.space("marketing")
# All operations are scoped to "marketing" space
connector = marketing_client.actions.create(
name="Marketing Webhook",
connector_type_id=".webhook",
config={"url": "https://example.com/webhook"}
)
Error Handling¶
from kibana import Kibana
from kibana.exceptions import (
NotFoundError,
BadRequestError,
SpaceNotFoundError
)
client = Kibana("http://localhost:5601")
try:
connector = client.actions.get(id="my-connector")
except NotFoundError:
print("Connector not found")
except BadRequestError as e:
print(f"Invalid request: {e.message}")
except SpaceNotFoundError as e:
print(f"Space not found: {e.space_id}")
See Also¶
Installation - Installation instructions
Quick Start - Quick start guide
User Guide - User guide with detailed examples
Examples - Example code and patterns