buildgrid.server.request_metadata_utils module

buildgrid.server.request_metadata_utils.printable_request_metadata(context: grpc.ServicerContext) → str

Given a grpc.ServicerContext object, return a human-readable representation of its RequestMetadata.

Parameters

context (grpc.ServicerContext) – Context for a RPC call.

Returns

A string with the metadata contents.

buildgrid.server.request_metadata_utils.extract_request_metadata(context) → build.bazel.remote.execution.v2.remote_execution_pb2.RequestMetadata

Given a grpc.ServicerContext object, extract the RequestMetadata header values if they are present. If they were not provided, returns an empty message.

Parameters

context (grpc.ServicerContext) – Context for a RPC call.

Returns

A RequestMetadata proto. If the metadata is not defined in the request, the message will be empty.