numerous.client_common.validation_interceptor module#

class numerous.client_common.validation_interceptor.ValidationInterceptor(token, token_callback, instance=None)#

Bases: ClientInterceptor

intercept(method, request_or_iterator, call_details)#

Override this method to implement a custom interceptor.

This method is called for all unary and streaming RPCs. The interceptor implementation should call method using a grpc.ClientCallDetails and the request_or_iterator object as parameters. The request_or_iterator parameter may be type checked to determine if this is a singluar request for unary RPCs or an iterator for client-streaming or client-server streaming RPCs.

Args:
method: A function that proceeds with the invocation by executing the next

interceptor in the chain or invoking the actual RPC on the underlying channel.

request_or_iterator: RPC request message or iterator of request messages

for streaming requests.

call_details: Describes an RPC to be invoked.

Returns:

The type of the return should match the type of the return value received by calling method. This is an object that is both a Call for the RPC and a Future.

The actual result from the RPC can be got by calling .result() on the value returned from method.