Client API Reference¶
The main entry point for interacting with the Honeycomb API.
HoneycombClient¶
HoneycombClient ¶
Async-first client for the Honeycomb API.
Supports both async and sync usage patterns.
Example (async - recommended): >>> async with HoneycombClient(api_key="your-key") as client: ... datasets = await client.datasets.list() ... triggers = await client.triggers.list(dataset="my-dataset")
Example (sync): >>> with HoneycombClient(api_key="your-key", sync=True) as client: ... datasets = client.datasets.list()
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
api_key
|
str | None
|
Honeycomb API key for single-environment access. |
None
|
management_key
|
str | None
|
Management API key ID for multi-environment access. |
None
|
management_secret
|
str | None
|
Management API key secret. |
None
|
base_url
|
str
|
API base URL (default: https://api.honeycomb.io). |
DEFAULT_BASE_URL
|
timeout
|
float
|
Request timeout in seconds (default: 30). |
DEFAULT_TIMEOUT
|
max_retries
|
int
|
Maximum retry attempts for failed requests (default: 3). |
DEFAULT_MAX_RETRIES
|
retry_config
|
RetryConfig | None
|
Custom retry configuration (optional, overrides max_retries). |
None
|
sync
|
bool
|
If True, use synchronous HTTP client (default: False). |
False
|
query_annotations
property
¶
Access the Query Annotations API.
derived_columns
property
¶
Access the Derived Columns (Calculated Fields) API.
environments
property
¶
Access the Environments API (v2 team-scoped).
service_map_dependencies
property
¶
Access the Service Map Dependencies API.
get_async
async
¶
Make an async GET request.
post_async
async
¶
post_async(
path: str,
*,
json: dict | None = None,
params: dict | None = None,
headers: dict[str, str] | None = None
) -> httpx.Response
Make an async POST request.
put_async
async
¶
put_async(
path: str,
*,
json: dict | None = None,
params: dict | None = None,
headers: dict[str, str] | None = None
) -> httpx.Response
Make an async PUT request.
patch_async
async
¶
patch_async(
path: str,
*,
json: dict | None = None,
params: dict | None = None,
headers: dict[str, str] | None = None
) -> httpx.Response
Make an async PATCH request.
delete_async
async
¶
Make an async DELETE request.
get_sync ¶
Make a sync GET request.
post_sync ¶
post_sync(
path: str,
*,
json: dict | None = None,
params: dict | None = None,
headers: dict[str, str] | None = None
) -> httpx.Response
Make a sync POST request.
put_sync ¶
put_sync(
path: str,
*,
json: dict | None = None,
params: dict | None = None,
headers: dict[str, str] | None = None
) -> httpx.Response
Make a sync PUT request.
patch_sync ¶
patch_sync(
path: str,
*,
json: dict | None = None,
params: dict | None = None,
headers: dict[str, str] | None = None
) -> httpx.Response
Make a sync PATCH request.
delete_sync ¶
Make a sync DELETE request.
Configuration Classes¶
RetryConfig¶
RetryConfig
dataclass
¶
Configuration for retry behavior.
Attributes:
| Name | Type | Description |
|---|---|---|
max_retries |
int
|
Maximum number of retry attempts. |
base_delay |
float
|
Base delay in seconds for exponential backoff. |
max_delay |
float
|
Maximum delay in seconds between retries. |
exponential_base |
float
|
Base for exponential backoff calculation. |
retry_statuses |
set[int]
|
HTTP status codes that should trigger a retry. |
RateLimitInfo¶
RateLimitInfo
dataclass
¶
Rate limit information from response headers.
Attributes:
| Name | Type | Description |
|---|---|---|
limit |
int | None
|
Total requests allowed in the time window. |
remaining |
int | None
|
Remaining requests in the current time window. |
reset |
int | None
|
Seconds until the rate limit resets. |
Usage Examples¶
Basic Async Client¶
import asyncio
from honeycomb import HoneycombClient
async def main():
async with HoneycombClient(api_key="your-key") as client:
datasets = await client.datasets.list_async()
print(f"Found {len(datasets)} datasets")
asyncio.run(main())
Sync Client¶
from honeycomb import HoneycombClient
with HoneycombClient(api_key="your-key", sync=True) as client:
datasets = client.datasets.list()
Custom Configuration¶
from honeycomb import HoneycombClient, RetryConfig
retry_config = RetryConfig(
max_retries=5,
base_delay=2.0,
max_delay=60.0,
retry_statuses={429, 503},
)
async with HoneycombClient(
api_key="your-key",
base_url="https://api.honeycomb.io",
timeout=30.0,
retry_config=retry_config,
) as client:
# Your code here
pass