module documentation

Add idempotency keys to asynchronous gRPC client calls.

The interceptor adds a unique UUID4 key to the x-idempotency-key header. It does not replace an existing key. The key lets the server prevent duplicate effects when a client retries an operation.

Class IdempotencyKeyInterceptor Add idempotency keys to unary-unary gRPC calls.
Function add_key_to_metadata Add a new idempotency key to the 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 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.

Add a new key if the metadata has no key or has an empty key.

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