class documentation

class IdempotencyKeyInterceptor(UnaryUnaryClientInterceptor): (source)

View In Hierarchy

gRPC client interceptor that adds idempotency keys to unary-unary calls.

This interceptor ensures that every gRPC call has an idempotency key in its metadata, which helps prevent duplicate operations on the server side.

Async Method intercept_unary_unary Intercept a unary-unary gRPC call and ensure idempotency key is present.
async def intercept_unary_unary(self, continuation: Callable[[ClientCallDetails, Req], UnaryUnaryCall | Res], client_call_details: ClientCallDetails, request: Req) -> UnaryUnaryCall | Res: (source) ΒΆ

Intercept a unary-unary gRPC call and ensure idempotency key is present.

Parameters
continuation:Callable[[ClientCallDetails, Req], UnaryUnaryCall | Res]The next interceptor in the chain or the actual call.
client_call_details:ClientCallDetailsDetails of the client call, including metadata.
request:ReqThe request payload.
Returns
UnaryUnaryCall | ResThe result of the gRPC call.