Shared utilities for Kibana operations, authentication, and workflows
Project description
kb-dashboard-tools
Shared utilities for Kibana operations, authentication, and workflows. This package provides common functionality used across the kb-yaml-to-lens ecosystem, including CLI tools, Language Server Protocol (LSP) servers, and future MCP servers.
Features
- KibanaClient: HTTP client for interacting with Kibana's Saved Objects API and Elasticsearch APIs
- Authentication utilities: Credential normalization and URL redaction for safe logging
- Result pattern: Type-safe error handling without exceptions
- ES|QL support: Models for ES|QL query execution and results
Installation
pip install kb-dashboard-tools
Usage
Kibana Client
from kb_dashboard_tools import KibanaClient
# Note: ssl_verify=False is only for local development with self-signed certificates.
# Always use ssl_verify=True (the default) in production environments.
async with KibanaClient(
url='https://localhost:5601',
username='elastic',
password='changeme',
ssl_verify=False, # Only for local dev with self-signed certs
) as client:
# Upload a dashboard
result = await client.upload_ndjson('dashboard.ndjson')
# Execute ES|QL query
esql_result = await client.execute_esql('FROM logs | LIMIT 10')
print(f'Found {esql_result.row_count} rows')
Authentication Utilities
from kb_dashboard_tools import normalize_credentials, redact_url
# Normalize credentials (converts empty strings to None)
api_key = normalize_credentials(user_input)
# Redact credentials from URLs for safe logging
safe_url = redact_url('https://user:pass@example.com:9200/path')
# Returns: 'https://example.com:9200/path'
Result Pattern
from kb_dashboard_tools import Result
def divide(a: int, b: int) -> Result[float]:
if b == 0:
return Result.fail('Division by zero')
return Result.ok(a / b)
result = divide(10, 2)
if result.success:
print(f'Result: {result.unwrap()}')
else:
print(f'Error: {result.error}')
Development
See the main repository's DEVELOPING.md for development setup.
# Install dependencies
make install
# Run CI checks
make ci
# Run tests
make test
License
MIT
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 kb_dashboard_tools-0.2.3.tar.gz.
File metadata
- Download URL: kb_dashboard_tools-0.2.3.tar.gz
- Upload date:
- Size: 13.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bfa2ca919b098b8cefa1ff73bb128feff150239a928a35b457ba1b608f83fbae
|
|
| MD5 |
bab22afbf25f240c829c918958dc569b
|
|
| BLAKE2b-256 |
b97b367ca6160abaca12960b5031f77405b3f55e07c82d7793249110145bae62
|
File details
Details for the file kb_dashboard_tools-0.2.3-py3-none-any.whl.
File metadata
- Download URL: kb_dashboard_tools-0.2.3-py3-none-any.whl
- Upload date:
- Size: 13.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6b6593aa7a4bbeaac47490e2d00e3a824f5169b5ec4329ea3b3a719a1dbe1ff6
|
|
| MD5 |
38af971a1c51ea53ac5acd5c8ce62d17
|
|
| BLAKE2b-256 |
e59b10f73bb5e83062b830b371a0d564920eb8dd8ce61568dbab80dbbd06703b
|