Public Member Functions | |
def | abort (self, code, details) |
def | abort_with_status (self, status) |
def | auth_context (self) |
def | code (self) |
def | details (self) |
def | disable_next_message_compression (self) |
def | invocation_metadata (self) |
def | peer (self) |
def | peer_identities (self) |
def | peer_identity_key (self) |
def | send_initial_metadata (self, initial_metadata) |
def | set_code (self, code) |
def | set_compression (self, compression) |
def | set_details (self, details) |
def | set_trailing_metadata (self, trailing_metadata) |
def | trailing_metadata (self) |
![]() | |
def | add_callback (self, callback) |
def | cancel (self) |
def | is_active (self) |
def | time_remaining (self) |
A context object passed to method implementations.
Definition at line 1083 of file src/python/grpcio/grpc/__init__.py.
def grpc.ServicerContext.abort | ( | self, | |
code, | |||
details | |||
) |
Raises an exception to terminate the RPC with a non-OK status. The code and details passed as arguments will supercede any existing ones. Args: code: A StatusCode object to be sent to the client. It must not be StatusCode.OK. details: A UTF-8-encodable string to be sent to the client upon termination of the RPC. Raises: Exception: An exception is always raised to signal the abortion the RPC to the gRPC runtime.
Reimplemented in grpc._server._Context, and grpc_testing._server._servicer_context.ServicerContext.
Definition at line 1192 of file src/python/grpcio/grpc/__init__.py.
def grpc.ServicerContext.abort_with_status | ( | self, | |
status | |||
) |
Raises an exception to terminate the RPC with a non-OK status. The status passed as argument will supercede any existing status code, status message and trailing metadata. This is an EXPERIMENTAL API. Args: status: A grpc.Status object. The status code in it must not be StatusCode.OK. Raises: Exception: An exception is always raised to signal the abortion the RPC to the gRPC runtime.
Reimplemented in grpc._server._Context, and grpc_testing._server._servicer_context.ServicerContext.
Definition at line 1211 of file src/python/grpcio/grpc/__init__.py.
def grpc.ServicerContext.auth_context | ( | self | ) |
Gets the auth context for the call. Returns: A map of strings to an iterable of bytes for each auth property.
Reimplemented in grpc._server._Context, and grpc_testing._server._servicer_context.ServicerContext.
Definition at line 1132 of file src/python/grpcio/grpc/__init__.py.
def grpc.ServicerContext.code | ( | self | ) |
Accesses the value to be used as status code upon RPC completion. This is an EXPERIMENTAL API. Returns: The StatusCode value for the RPC.
Reimplemented in grpc._server._Context.
Definition at line 1254 of file src/python/grpcio/grpc/__init__.py.
def grpc.ServicerContext.details | ( | self | ) |
Accesses the value to be used as detail string upon RPC completion. This is an EXPERIMENTAL API. Returns: The details string of the RPC.
Reimplemented in grpc._server._Context.
Definition at line 1264 of file src/python/grpcio/grpc/__init__.py.
def grpc.ServicerContext.disable_next_message_compression | ( | self | ) |
Disables compression for the next response message. This is an EXPERIMENTAL method. This method will override any compression configuration set during server creation or set on the call.
Reimplemented in grpc._server._Context, and grpc_testing._server._servicer_context.ServicerContext.
Definition at line 1274 of file src/python/grpcio/grpc/__init__.py.
def grpc.ServicerContext.invocation_metadata | ( | self | ) |
Accesses the metadata from the sent by the client. Returns: The invocation :term:`metadata`.
Reimplemented in grpc._server._Context, and grpc_testing._server._servicer_context.ServicerContext.
Definition at line 1087 of file src/python/grpcio/grpc/__init__.py.
def grpc.ServicerContext.peer | ( | self | ) |
Identifies the peer that invoked the RPC being serviced. Returns: A string identifying the peer that invoked the RPC being serviced. The string format is determined by gRPC runtime.
Reimplemented in grpc._server._Context, and grpc_testing._server._servicer_context.ServicerContext.
Definition at line 1096 of file src/python/grpcio/grpc/__init__.py.
def grpc.ServicerContext.peer_identities | ( | self | ) |
Gets one or more peer identity(s). Equivalent to servicer_context.auth_context().get(servicer_context.peer_identity_key()) Returns: An iterable of the identities, or None if the call is not authenticated. Each identity is returned as a raw bytes type.
Reimplemented in grpc._server._Context, and grpc_testing._server._servicer_context.ServicerContext.
Definition at line 1106 of file src/python/grpcio/grpc/__init__.py.
def grpc.ServicerContext.peer_identity_key | ( | self | ) |
The auth property used to identify the peer. For example, "x509_common_name" or "x509_subject_alternative_name" are used to identify an SSL peer. Returns: The auth property (string) that indicates the peer identity, or None if the call is not authenticated.
Reimplemented in grpc._server._Context, and grpc_testing._server._servicer_context.ServicerContext.
Definition at line 1119 of file src/python/grpcio/grpc/__init__.py.
def grpc.ServicerContext.send_initial_metadata | ( | self, | |
initial_metadata | |||
) |
Sends the initial metadata value to the client. This method need not be called by implementations if they have no metadata to add to what the gRPC runtime will transmit. Args: initial_metadata: The initial :term:`metadata`.
Reimplemented in grpc._server._Context, and grpc_testing._server._servicer_context.ServicerContext.
Definition at line 1152 of file src/python/grpcio/grpc/__init__.py.
def grpc.ServicerContext.set_code | ( | self, | |
code | |||
) |
Sets the value to be used as status code upon RPC completion. This method need not be called by method implementations if they wish the gRPC runtime to determine the status code of the RPC. Args: code: A StatusCode object to be sent to the client.
Reimplemented in grpc._server._Context, and grpc_testing._server._servicer_context.ServicerContext.
Definition at line 1230 of file src/python/grpcio/grpc/__init__.py.
def grpc.ServicerContext.set_compression | ( | self, | |
compression | |||
) |
Set the compression algorithm to be used for the entire call. This is an EXPERIMENTAL method. Args: compression: An element of grpc.compression, e.g. grpc.compression.Gzip.
Reimplemented in grpc._server._Context.
Definition at line 1140 of file src/python/grpcio/grpc/__init__.py.
def grpc.ServicerContext.set_details | ( | self, | |
details | |||
) |
Sets the value to be used as detail string upon RPC completion. This method need not be called by method implementations if they have no details to transmit. Args: details: A UTF-8-encodable string to be sent to the client upon termination of the RPC.
Reimplemented in grpc._server._Context, and grpc_testing._server._servicer_context.ServicerContext.
Definition at line 1242 of file src/python/grpcio/grpc/__init__.py.
def grpc.ServicerContext.set_trailing_metadata | ( | self, | |
trailing_metadata | |||
) |
Sets the trailing metadata for the RPC. Sets the trailing metadata to be sent upon completion of the RPC. If this method is invoked multiple times throughout the lifetime of an RPC, the value supplied in the final invocation will be the value sent over the wire. This method need not be called by implementations if they have no metadata to add to what the gRPC runtime will transmit. Args: trailing_metadata: The trailing :term:`metadata`.
Reimplemented in grpc._server._Context, and grpc_testing._server._servicer_context.ServicerContext.
Definition at line 1164 of file src/python/grpcio/grpc/__init__.py.
def grpc.ServicerContext.trailing_metadata | ( | self | ) |
Access value to be used as trailing metadata upon RPC completion. This is an EXPERIMENTAL API. Returns: The trailing :term:`metadata` for the RPC.
Reimplemented in grpc._server._Context.
Definition at line 1181 of file src/python/grpcio/grpc/__init__.py.