from nozle import (
NozleAPIError,
NozleAuthenticationError,
NozleTransportError,
NozleValidationError,
)
try:
result = nozle.usage.track(
"workspace_123",
"agent_execution",
idempotency_key="execution-0183f",
)
except NozleAuthenticationError:
logger.exception("Nozle secret-key configuration is invalid")
except NozleValidationError as error:
logger.warning("Invalid Nozle request: %s", error)
except NozleTransportError as error:
logger.warning("Nozle transport failed for %s", error.operation)
except NozleAPIError as error:
logger.warning(
"Nozle %s returned %s: %r",
error.operation,
error.status_code,
error.response_details,
)