示例#1
0
 def StreamStream(
     self,
     request: typing.Iterator[dummy_pb2.DummyRequest],
     context: grpc.ServicerContext,
 ) -> typing.Iterator[dummy_pb2.DummyReply]:
     for data in request:
         yield dummy_pb2.DummyReply(value=data.value.upper())
示例#2
0
 def UnaryStream(
     self,
     request: dummy_pb2.DummyRequest,
     context: grpc.ServicerContext,
 ) -> typing.Iterator[dummy_pb2.DummyReply]:
     for char in request.value:
         yield dummy_pb2.DummyReply(value=char)
示例#3
0
 def StreamUnary(
     self,
     request: typing.Iterator[dummy_pb2.DummyRequest],
     context: grpc.ServicerContext,
 ) -> dummy_pb2.DummyReply:
     return dummy_pb2.DummyReply(value="".join(data.value
                                               for data in request))
示例#4
0
 def UnaryUnary(
     self,
     request: dummy_pb2.DummyRequest,
     context: grpc.ServicerContext,
 ) -> dummy_pb2.DummyReply:
     return dummy_pb2.DummyReply(value=request.value[::-1])