module documentation

Idempotency key interceptor for gRPC aio clients.

This module provides functionality to automatically add idempotency keys to gRPC client calls, ensuring that operations can be safely retried without causing duplicate side effects on the server.

The interceptor adds a unique UUID4 key to the 'x-idempotency-key' header for each call that doesn't already have one.

Class IdempotencyKeyInterceptor gRPC client interceptor that adds idempotency keys to unary-unary calls.
Function add_key_to_metadata Add a new idempotency key to the provided metadata.
Function ensure_key_in_metadata Ensure an idempotency key is present in the metadata.
Function new_key Generate a new idempotency key.
Constant HEADER The gRPC metadata header name used for idempotency keys.
Type Variable Req Undocumented
Type Variable Res Undocumented
Variable log Undocumented
def add_key_to_metadata(metadata: Metadata | GRPCMetadata): (source)

Add a new idempotency key to the provided metadata.

Parameters
metadata:Metadata | GRPCMetadataThe metadata object to add the key to.
def ensure_key_in_metadata(metadata: Metadata | GRPCMetadata): (source)

Ensure an idempotency key is present in the metadata.

If no idempotency key exists or it's empty, a new one is added.

Parameters
metadata:Metadata | GRPCMetadataThe metadata object to check and potentially modify.
def new_key() -> str: (source)

Generate a new idempotency key.

Returns
strA new UUID4 string to use as an idempotency key.

The gRPC metadata header name used for idempotency keys.

Value
'x-idempotency-key'

Undocumented

Value
TypeVar('Req')

Undocumented

Value
TypeVar('Res')

Undocumented