Skip to content

prefactor_core.utils module

Utility functions for prefactor-core.

prefactor_core.utils.generate_idempotency_key() → str

Section titled “prefactor_core.utils.generate_idempotency_key() → str”

Generate a new UUID-based idempotency key.

The returned key is a UUID4 string (36 characters), always within the 64-character API limit.

  • Returns: A unique idempotency key string.

prefactor_core.utils.validate_idempotency_key(key: str) → str

Section titled “prefactor_core.utils.validate_idempotency_key(key: str) → str”

Validate that an idempotency key is a non-empty string of at most 64 characters.

  • Parameters: key – The idempotency key to validate.
  • Returns: The key unchanged if valid.
  • Raises: ValueError – If the key is empty or exceeds 64 characters.