當前位置: 首頁>>代碼示例>>Python>>正文


Python grpc.stream_unary_rpc_method_handler方法代碼示例

本文整理匯總了Python中grpc.stream_unary_rpc_method_handler方法的典型用法代碼示例。如果您正苦於以下問題:Python grpc.stream_unary_rpc_method_handler方法的具體用法?Python grpc.stream_unary_rpc_method_handler怎麽用?Python grpc.stream_unary_rpc_method_handler使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在grpc的用法示例。


在下文中一共展示了grpc.stream_unary_rpc_method_handler方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: add_DataTransferServiceServicer_to_server

# 需要導入模塊: import grpc [as 別名]
# 或者: from grpc import stream_unary_rpc_method_handler [as 別名]
def add_DataTransferServiceServicer_to_server(servicer, server):
  rpc_method_handlers = {
      'push': grpc.stream_unary_rpc_method_handler(
          servicer.push,
          request_deserializer=fate__proxy__pb2.Packet.FromString,
          response_serializer=fate__proxy__pb2.Metadata.SerializeToString,
      ),
      'pull': grpc.unary_stream_rpc_method_handler(
          servicer.pull,
          request_deserializer=fate__proxy__pb2.Metadata.FromString,
          response_serializer=fate__proxy__pb2.Packet.SerializeToString,
      ),
      'unaryCall': grpc.unary_unary_rpc_method_handler(
          servicer.unaryCall,
          request_deserializer=fate__proxy__pb2.Packet.FromString,
          response_serializer=fate__proxy__pb2.Packet.SerializeToString,
      ),
  }
  generic_handler = grpc.method_handlers_generic_handler(
      'com.webank.ai.fate.api.networking.proxy.DataTransferService', rpc_method_handlers)
  server.add_generic_rpc_handlers((generic_handler,)) 
開發者ID:FederatedAI,項目名稱:FATE,代碼行數:23,代碼來源:fate_proxy_pb2_grpc.py

示例2: add_DataTransferServiceServicer_to_server

# 需要導入模塊: import grpc [as 別名]
# 或者: from grpc import stream_unary_rpc_method_handler [as 別名]
def add_DataTransferServiceServicer_to_server(servicer, server):
  rpc_method_handlers = {
      'push': grpc.stream_unary_rpc_method_handler(
          servicer.push,
          request_deserializer=proxy__pb2.Packet.FromString,
          response_serializer=proxy__pb2.Metadata.SerializeToString,
      ),
      'pull': grpc.unary_stream_rpc_method_handler(
          servicer.pull,
          request_deserializer=proxy__pb2.Metadata.FromString,
          response_serializer=proxy__pb2.Packet.SerializeToString,
      ),
      'unaryCall': grpc.unary_unary_rpc_method_handler(
          servicer.unaryCall,
          request_deserializer=proxy__pb2.Packet.FromString,
          response_serializer=proxy__pb2.Packet.SerializeToString,
      ),
  }
  generic_handler = grpc.method_handlers_generic_handler(
      'com.webank.ai.eggroll.api.networking.proxy.DataTransferService', rpc_method_handlers)
  server.add_generic_rpc_handlers((generic_handler,)) 
開發者ID:FederatedAI,項目名稱:FATE,代碼行數:23,代碼來源:proxy_pb2_grpc.py

示例3: add_MockServiceServicer_to_server

# 需要導入模塊: import grpc [as 別名]
# 或者: from grpc import stream_unary_rpc_method_handler [as 別名]
def add_MockServiceServicer_to_server(servicer, server):
  rpc_method_handlers = {
      'UnaryDoSomething': grpc.unary_unary_rpc_method_handler(
          servicer.UnaryDoSomething,
          request_deserializer=mocker_dot_endpoints_dot_grpc__endpoint__pb2.StringMessage.FromString,
          response_serializer=mocker_dot_endpoints_dot_grpc__endpoint__pb2.StringMessage.SerializeToString,
      ),
      'ClientStreamDoSomething': grpc.stream_unary_rpc_method_handler(
          servicer.ClientStreamDoSomething,
          request_deserializer=mocker_dot_endpoints_dot_grpc__endpoint__pb2.IntMessage.FromString,
          response_serializer=mocker_dot_endpoints_dot_grpc__endpoint__pb2.IntCollectionMessage.SerializeToString,
      ),
      'ServerSteramDoSomething': grpc.unary_stream_rpc_method_handler(
          servicer.ServerSteramDoSomething,
          request_deserializer=mocker_dot_endpoints_dot_grpc__endpoint__pb2.IntCollectionMessage.FromString,
          response_serializer=mocker_dot_endpoints_dot_grpc__endpoint__pb2.IntMessage.SerializeToString,
      ),
  }
  generic_handler = grpc.method_handlers_generic_handler(
      'etcdserverpb.MockService', rpc_method_handlers)
  server.add_generic_rpc_handlers((generic_handler,)) 
開發者ID:dcos,項目名稱:dcos,代碼行數:23,代碼來源:grpc_endpoint_pb2_grpc.py

示例4: _wrap_rpc_behavior

# 需要導入模塊: import grpc [as 別名]
# 或者: from grpc import stream_unary_rpc_method_handler [as 別名]
def _wrap_rpc_behavior(handler, fn):
    """Returns a new rpc handler that wraps the given function"""
    if handler is None:
        return None

    if handler.request_streaming and handler.response_streaming:
        behavior_fn = handler.stream_stream
        handler_factory = grpc.stream_stream_rpc_method_handler
    elif handler.request_streaming and not handler.response_streaming:
        behavior_fn = handler.stream_unary
        handler_factory = grpc.stream_unary_rpc_method_handler
    elif not handler.request_streaming and handler.response_streaming:
        behavior_fn = handler.unary_stream
        handler_factory = grpc.unary_stream_rpc_method_handler
    else:
        behavior_fn = handler.unary_unary
        handler_factory = grpc.unary_unary_rpc_method_handler

    return handler_factory(
        fn(behavior_fn, handler.request_streaming,
           handler.response_streaming),
        request_deserializer=handler.request_deserializer,
        response_serializer=handler.response_serializer
    ) 
開發者ID:census-instrumentation,項目名稱:opencensus-python,代碼行數:26,代碼來源:server_interceptor.py

示例5: add_TransferServiceServicer_to_server

# 需要導入模塊: import grpc [as 別名]
# 或者: from grpc import stream_unary_rpc_method_handler [as 別名]
def add_TransferServiceServicer_to_server(servicer, server):
  rpc_method_handlers = {
      'send': grpc.stream_unary_rpc_method_handler(
          servicer.send,
          request_deserializer=transfer__pb2.TransferBatch.FromString,
          response_serializer=transfer__pb2.TransferBatch.SerializeToString,
      ),
      'recv': grpc.unary_stream_rpc_method_handler(
          servicer.recv,
          request_deserializer=transfer__pb2.TransferBatch.FromString,
          response_serializer=transfer__pb2.TransferBatch.SerializeToString,
      ),
      'sendRecv': grpc.stream_stream_rpc_method_handler(
          servicer.sendRecv,
          request_deserializer=transfer__pb2.TransferBatch.FromString,
          response_serializer=transfer__pb2.TransferBatch.SerializeToString,
      ),
  }
  generic_handler = grpc.method_handlers_generic_handler(
      'com.webank.eggroll.core.transfer.TransferService', rpc_method_handlers)
  server.add_generic_rpc_handlers((generic_handler,)) 
開發者ID:WeBankFinTech,項目名稱:eggroll,代碼行數:23,代碼來源:transfer_pb2_grpc.py

示例6: add_HelloServiceServicer_to_server

# 需要導入模塊: import grpc [as 別名]
# 或者: from grpc import stream_unary_rpc_method_handler [as 別名]
def add_HelloServiceServicer_to_server(servicer, server):
  rpc_method_handlers = {
      'unaryCall': grpc.unary_unary_rpc_method_handler(
          servicer.unaryCall,
          request_deserializer=grpc__test__pb2.HelloRequest.FromString,
          response_serializer=grpc__test__pb2.HelloResponse.SerializeToString,
      ),
      'push': grpc.stream_unary_rpc_method_handler(
          servicer.push,
          request_deserializer=grpc__test__pb2.HelloRequest.FromString,
          response_serializer=grpc__test__pb2.HelloResponse.SerializeToString,
      ),
      'pull': grpc.unary_unary_rpc_method_handler(
          servicer.pull,
          request_deserializer=grpc__test__pb2.HelloRequest.FromString,
          response_serializer=grpc__test__pb2.HelloResponse.SerializeToString,
      ),
  }
  generic_handler = grpc.method_handlers_generic_handler(
      'com.webank.eggroll.grpc.test.HelloService', rpc_method_handlers)
  server.add_generic_rpc_handlers((generic_handler,)) 
開發者ID:WeBankFinTech,項目名稱:eggroll,代碼行數:23,代碼來源:grpc_test_pb2_grpc.py

示例7: add_WisdomServicer_to_server

# 需要導入模塊: import grpc [as 別名]
# 或者: from grpc import stream_unary_rpc_method_handler [as 別名]
def add_WisdomServicer_to_server(servicer, server):
    rpc_method_handlers = {
        'send': grpc.unary_unary_rpc_method_handler(
            servicer.send,
            request_deserializer=WisdomGrpcService__pb2.Event.FromString,
            response_serializer=WisdomGrpcService__pb2.Event.SerializeToString,
        ),
        'feed': grpc.stream_unary_rpc_method_handler(
            servicer.feed,
            request_deserializer=WisdomGrpcService__pb2.Event.FromString,
            response_serializer=WisdomGrpcService__pb2.Event.SerializeToString,
        ),
        'receive': grpc.unary_stream_rpc_method_handler(
            servicer.receive,
            request_deserializer=WisdomGrpcService__pb2.Event.FromString,
            response_serializer=WisdomGrpcService__pb2.Event.SerializeToString,
        ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
        'com.javahelps.wisdom.service.gprc.Wisdom', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,)) 
開發者ID:slgobinath,項目名稱:pcap-processor,代碼行數:23,代碼來源:WisdomGrpcService_pb2_grpc.py

示例8: add_GigagenieServicer_to_server

# 需要導入模塊: import grpc [as 別名]
# 或者: from grpc import stream_unary_rpc_method_handler [as 別名]
def add_GigagenieServicer_to_server(servicer, server):
  rpc_method_handlers = {
      'getVoice2Text': grpc.stream_stream_rpc_method_handler(
          servicer.getVoice2Text,
          request_deserializer=gigagenieRPC__pb2.reqVoice.FromString,
          response_serializer=gigagenieRPC__pb2.resText.SerializeToString,
      ),
      'getText2VoiceUrl': grpc.unary_unary_rpc_method_handler(
          servicer.getText2VoiceUrl,
          request_deserializer=gigagenieRPC__pb2.reqText.FromString,
          response_serializer=gigagenieRPC__pb2.resUrl.SerializeToString,
      ),
      'getText2VoiceStream': grpc.unary_stream_rpc_method_handler(
          servicer.getText2VoiceStream,
          request_deserializer=gigagenieRPC__pb2.reqText.FromString,
          response_serializer=gigagenieRPC__pb2.resVoice.SerializeToString,
      ),
      'queryByText': grpc.unary_unary_rpc_method_handler(
          servicer.queryByText,
          request_deserializer=gigagenieRPC__pb2.reqQueryText.FromString,
          response_serializer=gigagenieRPC__pb2.resQueryText.SerializeToString,
      ),
      'queryByVoice': grpc.stream_unary_rpc_method_handler(
          servicer.queryByVoice,
          request_deserializer=gigagenieRPC__pb2.reqQueryVoice.FromString,
          response_serializer=gigagenieRPC__pb2.resQueryText.SerializeToString,
      ),
  }
  generic_handler = grpc.method_handlers_generic_handler(
      'kt.gigagenie.ai.speech.Gigagenie', rpc_method_handlers)
  server.add_generic_rpc_handlers((generic_handler,)) 
開發者ID:gigagenie,項目名稱:ai-makers-kit,代碼行數:33,代碼來源:gigagenieRPC_pb2_grpc.py

示例9: add_GreeterServicer_to_server

# 需要導入模塊: import grpc [as 別名]
# 或者: from grpc import stream_unary_rpc_method_handler [as 別名]
def add_GreeterServicer_to_server(servicer, server):
  rpc_method_handlers = {
      'SayHello': grpc.unary_unary_rpc_method_handler(
          servicer.SayHello,
          request_deserializer=generated_dot_greeter__pb2.HelloRequest.FromString,
          response_serializer=generated_dot_greeter__pb2.HelloReply.SerializeToString,
      ),
      'SayHelloGoodbye': grpc.unary_stream_rpc_method_handler(
          servicer.SayHelloGoodbye,
          request_deserializer=generated_dot_greeter__pb2.HelloRequest.FromString,
          response_serializer=generated_dot_greeter__pb2.HelloReply.SerializeToString,
      ),
      'SayHelloToMany': grpc.stream_stream_rpc_method_handler(
          servicer.SayHelloToMany,
          request_deserializer=generated_dot_greeter__pb2.HelloRequest.FromString,
          response_serializer=generated_dot_greeter__pb2.HelloReply.SerializeToString,
      ),
      'SayHelloToManyAtOnce': grpc.stream_unary_rpc_method_handler(
          servicer.SayHelloToManyAtOnce,
          request_deserializer=generated_dot_greeter__pb2.HelloRequest.FromString,
          response_serializer=generated_dot_greeter__pb2.HelloReply.SerializeToString,
      ),
  }
  generic_handler = grpc.method_handlers_generic_handler(
      'Greeter', rpc_method_handlers)
  server.add_generic_rpc_handlers((generic_handler,)) 
開發者ID:standy66,項目名稱:purerpc,代碼行數:28,代碼來源:greeter_pb2_grpc.py

示例10: add_HetrServicer_to_server

# 需要導入模塊: import grpc [as 別名]
# 或者: from grpc import stream_unary_rpc_method_handler [as 別名]
def add_HetrServicer_to_server(servicer, server):
  rpc_method_handlers = {
      'BuildTransformer': grpc.unary_unary_rpc_method_handler(
          servicer.BuildTransformer,
          request_deserializer=ngraph_dot_transformers_dot_hetr_dot_hetr__pb2.BuildTransformerRequest.FromString,
          response_serializer=ngraph_dot_transformers_dot_hetr_dot_hetr__pb2.BuildTransformerReply.SerializeToString,
      ),
      'CloseTransformer': grpc.unary_unary_rpc_method_handler(
          servicer.CloseTransformer,
          request_deserializer=ngraph_dot_transformers_dot_hetr_dot_hetr__pb2.CloseTransformerRequest.FromString,
          response_serializer=ngraph_dot_transformers_dot_hetr_dot_hetr__pb2.CloseTransformerReply.SerializeToString,
      ),
      'Computation': grpc.stream_unary_rpc_method_handler(
          servicer.Computation,
          request_deserializer=ngraph_dot_transformers_dot_hetr_dot_hetr__pb2.ComputationRequest.FromString,
          response_serializer=ngraph_dot_transformers_dot_hetr_dot_hetr__pb2.ComputationReply.SerializeToString,
      ),
      'FeedInput': grpc.unary_unary_rpc_method_handler(
          servicer.FeedInput,
          request_deserializer=ngraph_dot_transformers_dot_hetr_dot_hetr__pb2.FeedInputRequest.FromString,
          response_serializer=ngraph_dot_transformers_dot_hetr_dot_hetr__pb2.FeedInputReply.SerializeToString,
      ),
      'GetResults': grpc.unary_unary_rpc_method_handler(
          servicer.GetResults,
          request_deserializer=ngraph_dot_transformers_dot_hetr_dot_hetr__pb2.GetResultsRequest.FromString,
          response_serializer=ngraph_dot_transformers_dot_hetr_dot_hetr__pb2.GetResultsReply.SerializeToString,
      ),
      'Close': grpc.unary_unary_rpc_method_handler(
          servicer.Close,
          request_deserializer=ngraph_dot_transformers_dot_hetr_dot_hetr__pb2.CloseRequest.FromString,
          response_serializer=ngraph_dot_transformers_dot_hetr_dot_hetr__pb2.CloseReply.SerializeToString,
      ),
  }
  generic_handler = grpc.method_handlers_generic_handler(
      'Hetr', rpc_method_handlers)
  server.add_generic_rpc_handlers((generic_handler,)) 
開發者ID:NervanaSystems,項目名稱:ngraph-python,代碼行數:38,代碼來源:hetr_pb2_grpc.py

示例11: add_HetrServicer_to_server

# 需要導入模塊: import grpc [as 別名]
# 或者: from grpc import stream_unary_rpc_method_handler [as 別名]
def add_HetrServicer_to_server(servicer, server):
    rpc_method_handlers = {
        'BuildTransformer': grpc.unary_unary_rpc_method_handler(
            servicer.BuildTransformer,
            request_deserializer=BuildTransformerRequest.FromString,
            response_serializer=BuildTransformerReply.SerializeToString,
        ),
        'CloseTransformer': grpc.unary_unary_rpc_method_handler(
            servicer.CloseTransformer,
            request_deserializer=CloseTransformerRequest.FromString,
            response_serializer=CloseTransformerReply.SerializeToString,
        ),
        'Computation': grpc.stream_unary_rpc_method_handler(
            servicer.Computation,
            request_deserializer=ComputationRequest.FromString,
            response_serializer=ComputationReply.SerializeToString,
        ),
        'FeedInput': grpc.unary_unary_rpc_method_handler(
            servicer.FeedInput,
            request_deserializer=FeedInputRequest.FromString,
            response_serializer=FeedInputReply.SerializeToString,
        ),
        'GetResults': grpc.unary_unary_rpc_method_handler(
            servicer.GetResults,
            request_deserializer=GetResultsRequest.FromString,
            response_serializer=GetResultsReply.SerializeToString,
        ),
        'Close': grpc.unary_unary_rpc_method_handler(
            servicer.Close,
            request_deserializer=CloseRequest.FromString,
            response_serializer=CloseReply.SerializeToString,
        ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
        'Hetr', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,)) 
開發者ID:NervanaSystems,項目名稱:ngraph-python,代碼行數:38,代碼來源:hetr_pb2.py

示例12: add_StanServicer_to_server

# 需要導入模塊: import grpc [as 別名]
# 或者: from grpc import stream_unary_rpc_method_handler [as 別名]
def add_StanServicer_to_server(servicer, server):
  rpc_method_handlers = {
      'OneQuestionOneResponse': grpc.unary_unary_rpc_method_handler(
          servicer.OneQuestionOneResponse,
          request_deserializer=stan__pb2.QuestionRequest.FromString,
          response_serializer=stan__pb2.QuestionResponse.SerializeToString,
      ),
      'ManyQuestionsOneResponse': grpc.stream_unary_rpc_method_handler(
          servicer.ManyQuestionsOneResponse,
          request_deserializer=stan__pb2.QuestionRequest.FromString,
          response_serializer=stan__pb2.QuestionResponse.SerializeToString,
      ),
      'OneQuestionManyResponses': grpc.unary_stream_rpc_method_handler(
          servicer.OneQuestionManyResponses,
          request_deserializer=stan__pb2.QuestionRequest.FromString,
          response_serializer=stan__pb2.QuestionResponse.SerializeToString,
      ),
      'ManyQuestionsManyReponses': grpc.stream_stream_rpc_method_handler(
          servicer.ManyQuestionsManyReponses,
          request_deserializer=stan__pb2.QuestionRequest.FromString,
          response_serializer=stan__pb2.QuestionResponse.SerializeToString,
      ),
      'OneQuestionOneErrorResponse': grpc.unary_unary_rpc_method_handler(
          servicer.OneQuestionOneErrorResponse,
          request_deserializer=stan__pb2.QuestionRequest.FromString,
          response_serializer=stan__pb2.QuestionResponse.SerializeToString,
      ),
      'OneErroredQuestionOneResponse': grpc.unary_unary_rpc_method_handler(
          servicer.OneErroredQuestionOneResponse,
          request_deserializer=stan__pb2.QuestionRequest.FromString,
          response_serializer=stan__pb2.QuestionResponse.SerializeToString,
      ),
  }
  generic_handler = grpc.method_handlers_generic_handler(
      'stan.Stan', rpc_method_handlers)
  server.add_generic_rpc_handlers((generic_handler,)) 
開發者ID:instana,項目名稱:python-sensor,代碼行數:38,代碼來源:stan_pb2_grpc.py

示例13: add_TestServiceServicer_to_server

# 需要導入模塊: import grpc [as 別名]
# 或者: from grpc import stream_unary_rpc_method_handler [as 別名]
def add_TestServiceServicer_to_server(servicer, server):
  rpc_method_handlers = {
      'NormalMethod': grpc.unary_unary_rpc_method_handler(
          servicer.NormalMethod,
          request_deserializer=service__pb2.StandardRequest.FromString,
          response_serializer=service__pb2.StandardReply.SerializeToString,
      ),
      'StreamMethod': grpc.unary_stream_rpc_method_handler(
          servicer.StreamMethod,
          request_deserializer=service__pb2.StreamRequest.FromString,
          response_serializer=service__pb2.StandardReply.SerializeToString,
      ),
      'StreamInputMethod': grpc.stream_unary_rpc_method_handler(
          servicer.StreamInputMethod,
          request_deserializer=service__pb2.StandardRequest.FromString,
          response_serializer=service__pb2.StreamReply.SerializeToString,
      ),
      'StreamStreamMethod': grpc.stream_stream_rpc_method_handler(
          servicer.StreamStreamMethod,
          request_deserializer=service__pb2.StandardRequest.FromString,
          response_serializer=service__pb2.StandardReply.SerializeToString,
      ),
      'DelayedMethod': grpc.unary_unary_rpc_method_handler(
          servicer.DelayedMethod,
          request_deserializer=service__pb2.StandardRequest.FromString,
          response_serializer=service__pb2.StandardReply.SerializeToString,
      ),
      'ExceptionMethod': grpc.unary_unary_rpc_method_handler(
          servicer.ExceptionMethod,
          request_deserializer=service__pb2.StandardRequest.FromString,
          response_serializer=service__pb2.StandardReply.SerializeToString,
      ),
      'DelayedStream': grpc.unary_stream_rpc_method_handler(
          servicer.DelayedStream,
          request_deserializer=service__pb2.StreamRequest.FromString,
          response_serializer=service__pb2.StandardReply.SerializeToString,
      ),
  }
  generic_handler = grpc.method_handlers_generic_handler(
      'TestService', rpc_method_handlers)
  server.add_generic_rpc_handlers((generic_handler,)) 
開發者ID:hubo1016,項目名稱:aiogrpc,代碼行數:43,代碼來源:service_pb2_grpc.py

示例14: add_TestServiceServicer_to_server

# 需要導入模塊: import grpc [as 別名]
# 或者: from grpc import stream_unary_rpc_method_handler [as 別名]
def add_TestServiceServicer_to_server(servicer, server):
    rpc_method_handlers = {
        'NormalMethod': grpc.unary_unary_rpc_method_handler(
            servicer.NormalMethod,
            request_deserializer=StandardRequest.FromString,
            response_serializer=StandardReply.SerializeToString,
        ),
        'StreamMethod': grpc.unary_stream_rpc_method_handler(
            servicer.StreamMethod,
            request_deserializer=StreamRequest.FromString,
            response_serializer=StandardReply.SerializeToString,
        ),
        'StreamInputMethod': grpc.stream_unary_rpc_method_handler(
            servicer.StreamInputMethod,
            request_deserializer=StandardRequest.FromString,
            response_serializer=StreamReply.SerializeToString,
        ),
        'StreamStreamMethod': grpc.stream_stream_rpc_method_handler(
            servicer.StreamStreamMethod,
            request_deserializer=StandardRequest.FromString,
            response_serializer=StandardReply.SerializeToString,
        ),
        'DelayedMethod': grpc.unary_unary_rpc_method_handler(
            servicer.DelayedMethod,
            request_deserializer=StandardRequest.FromString,
            response_serializer=StandardReply.SerializeToString,
        ),
        'ExceptionMethod': grpc.unary_unary_rpc_method_handler(
            servicer.ExceptionMethod,
            request_deserializer=StandardRequest.FromString,
            response_serializer=StandardReply.SerializeToString,
        ),
        'DelayedStream': grpc.unary_stream_rpc_method_handler(
            servicer.DelayedStream,
            request_deserializer=StreamRequest.FromString,
            response_serializer=StandardReply.SerializeToString,
        ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
        'TestService', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,)) 
開發者ID:hubo1016,項目名稱:aiogrpc,代碼行數:43,代碼來源:service_pb2.py

示例15: add_StoreServicer_to_server

# 需要導入模塊: import grpc [as 別名]
# 或者: from grpc import stream_unary_rpc_method_handler [as 別名]
def add_StoreServicer_to_server(servicer, server):
    rpc_method_handlers = {
        'AddItem': grpc.unary_unary_rpc_method_handler(
            servicer.AddItem,
            request_deserializer=AddItemRequest.FromString,
            response_serializer=Empty.SerializeToString,
        ),
        'AddItems': grpc.stream_unary_rpc_method_handler(
            servicer.AddItems,
            request_deserializer=AddItemRequest.FromString,
            response_serializer=Empty.SerializeToString,
        ),
        'RemoveItem': grpc.unary_unary_rpc_method_handler(
            servicer.RemoveItem,
            request_deserializer=RemoveItemRequest.FromString,
            response_serializer=RemoveItemResponse.SerializeToString,
        ),
        'RemoveItems': grpc.stream_unary_rpc_method_handler(
            servicer.RemoveItems,
            request_deserializer=RemoveItemRequest.FromString,
            response_serializer=RemoveItemResponse.SerializeToString,
        ),
        'ListInventory': grpc.unary_stream_rpc_method_handler(
            servicer.ListInventory,
            request_deserializer=Empty.FromString,
            response_serializer=QuantityResponse.SerializeToString,
        ),
        'QueryQuantity': grpc.unary_unary_rpc_method_handler(
            servicer.QueryQuantity,
            request_deserializer=QueryItemRequest.FromString,
            response_serializer=QuantityResponse.SerializeToString,
        ),
        'QueryQuantities': grpc.stream_stream_rpc_method_handler(
            servicer.QueryQuantities,
            request_deserializer=QueryItemRequest.FromString,
            response_serializer=QuantityResponse.SerializeToString,
        ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
        'store.Store', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,)) 
開發者ID:opentracing-contrib,項目名稱:python-grpc,代碼行數:43,代碼來源:store_pb2.py


注:本文中的grpc.stream_unary_rpc_method_handler方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。