Closed jovany-wang closed 1 year ago
The python grpc code:
import grpc from your_grpc_module import your_pb2, your_pb2_grpc # Create gRPC channel channel = grpc.insecure_channel('localhost:50051') stub = your_pb2_grpc.YourServiceStub(channel) # Define the metadata metadata = [ ('header-key1', 'header-value1'), ('header-key2', 'header-value2'), ] # RPC call within metadata response = stub.YourRpcMethod(your_pb2.YourRequest(), metadata=metadata)
The python grpc code: