gRPC Status

Module Contents

Reference implementation for status mapping in gRPC Python.

grpc_status.rpc_status.from_call(call)[source]

Returns a google.rpc.status.Status message corresponding to a given grpc.Call.

This is an EXPERIMENTAL API.

Parameters:

call – A grpc.Call instance.

Returns:

A google.rpc.status.Status message representing the status of the RPC.

Raises:

ValueError – If the gRPC call’s code or details are inconsistent with the status code and message inside of the google.rpc.status.Status.

grpc_status.rpc_status.to_status(status)[source]

Convert a google.rpc.status.Status message to grpc.Status.

This is an EXPERIMENTAL API.

Parameters:

status – a google.rpc.status.Status message representing the non-OK status to terminate the RPC with and communicate it to the client.

Returns:

A grpc.Status instance representing the input google.rpc.status.Status message.