当前位置: 首页>>代码示例>>Python>>正文


Python grpc.unary_stream_rpc_method_handler方法代码示例

本文整理汇总了Python中grpc.unary_stream_rpc_method_handler方法的典型用法代码示例。如果您正苦于以下问题:Python grpc.unary_stream_rpc_method_handler方法的具体用法?Python grpc.unary_stream_rpc_method_handler怎么用?Python grpc.unary_stream_rpc_method_handler使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在grpc的用法示例。


在下文中一共展示了grpc.unary_stream_rpc_method_handler方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: add_QueryService_v1Servicer_to_server

# 需要导入模块: import grpc [as 别名]
# 或者: from grpc import unary_stream_rpc_method_handler [as 别名]
def add_QueryService_v1Servicer_to_server(servicer, server):
  rpc_method_handlers = {
      'Find': grpc.unary_unary_rpc_method_handler(
          servicer.Find,
          request_deserializer=queries__pb2.Query.FromString,
          response_serializer=qry__responses__pb2.QueryResponse.SerializeToString,
      ),
      'FetchCommits': grpc.unary_stream_rpc_method_handler(
          servicer.FetchCommits,
          request_deserializer=queries__pb2.BlocksQuery.FromString,
          response_serializer=qry__responses__pb2.BlockQueryResponse.SerializeToString,
      ),
  }
  generic_handler = grpc.method_handlers_generic_handler(
      'iroha.protocol.QueryService_v1', rpc_method_handlers)
  server.add_generic_rpc_handlers((generic_handler,)) 
开发者ID:hyperledger,项目名称:iroha-python,代码行数:18,代码来源:endpoint_pb2_grpc.py

示例2: add_DataTransferServiceServicer_to_server

# 需要导入模块: import grpc [as 别名]
# 或者: from grpc import unary_stream_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

示例3: add_DataTransferServiceServicer_to_server

# 需要导入模块: import grpc [as 别名]
# 或者: from grpc import unary_stream_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

示例4: add_LogFilesServiceServicer_to_server

# 需要导入模块: import grpc [as 别名]
# 或者: from grpc import unary_stream_rpc_method_handler [as 别名]
def add_LogFilesServiceServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'GetEntries': grpc.unary_unary_rpc_method_handler(
                    servicer.GetEntries,
                    request_deserializer=log__files_dot_log__files__pb2.GetEntriesRequest.FromString,
                    response_serializer=log__files_dot_log__files__pb2.GetEntriesResponse.SerializeToString,
            ),
            'SubscribeDownloadLogFile': grpc.unary_stream_rpc_method_handler(
                    servicer.SubscribeDownloadLogFile,
                    request_deserializer=log__files_dot_log__files__pb2.SubscribeDownloadLogFileRequest.FromString,
                    response_serializer=log__files_dot_log__files__pb2.DownloadLogFileResponse.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'mavsdk.rpc.log_files.LogFilesService', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))


 # This class is part of an EXPERIMENTAL API. 
开发者ID:mavlink,项目名称:MAVSDK-Python,代码行数:21,代码来源:log_files_pb2_grpc.py

示例5: add_ShellServiceServicer_to_server

# 需要导入模块: import grpc [as 别名]
# 或者: from grpc import unary_stream_rpc_method_handler [as 别名]
def add_ShellServiceServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'Send': grpc.unary_unary_rpc_method_handler(
                    servicer.Send,
                    request_deserializer=shell_dot_shell__pb2.SendRequest.FromString,
                    response_serializer=shell_dot_shell__pb2.SendResponse.SerializeToString,
            ),
            'SubscribeReceive': grpc.unary_stream_rpc_method_handler(
                    servicer.SubscribeReceive,
                    request_deserializer=shell_dot_shell__pb2.SubscribeReceiveRequest.FromString,
                    response_serializer=shell_dot_shell__pb2.ReceiveResponse.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'mavsdk.rpc.shell.ShellService', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))


 # This class is part of an EXPERIMENTAL API. 
开发者ID:mavlink,项目名称:MAVSDK-Python,代码行数:21,代码来源:shell_pb2_grpc.py

示例6: add_CoreServiceServicer_to_server

# 需要导入模块: import grpc [as 别名]
# 或者: from grpc import unary_stream_rpc_method_handler [as 别名]
def add_CoreServiceServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'SubscribeConnectionState': grpc.unary_stream_rpc_method_handler(
                    servicer.SubscribeConnectionState,
                    request_deserializer=core_dot_core__pb2.SubscribeConnectionStateRequest.FromString,
                    response_serializer=core_dot_core__pb2.ConnectionStateResponse.SerializeToString,
            ),
            'ListRunningPlugins': grpc.unary_unary_rpc_method_handler(
                    servicer.ListRunningPlugins,
                    request_deserializer=core_dot_core__pb2.ListRunningPluginsRequest.FromString,
                    response_serializer=core_dot_core__pb2.ListRunningPluginsResponse.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'mavsdk.rpc.core.CoreService', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))


 # This class is part of an EXPERIMENTAL API. 
开发者ID:mavlink,项目名称:MAVSDK-Python,代码行数:21,代码来源:core_pb2_grpc.py

示例7: add_GoogleAdsServiceServicer_to_server

# 需要导入模块: import grpc [as 别名]
# 或者: from grpc import unary_stream_rpc_method_handler [as 别名]
def add_GoogleAdsServiceServicer_to_server(servicer, server):
  rpc_method_handlers = {
      'Search': grpc.unary_unary_rpc_method_handler(
          servicer.Search,
          request_deserializer=google_dot_ads_dot_googleads__v3_dot_proto_dot_services_dot_google__ads__service__pb2.SearchGoogleAdsRequest.FromString,
          response_serializer=google_dot_ads_dot_googleads__v3_dot_proto_dot_services_dot_google__ads__service__pb2.SearchGoogleAdsResponse.SerializeToString,
      ),
      'SearchStream': grpc.unary_stream_rpc_method_handler(
          servicer.SearchStream,
          request_deserializer=google_dot_ads_dot_googleads__v3_dot_proto_dot_services_dot_google__ads__service__pb2.SearchGoogleAdsStreamRequest.FromString,
          response_serializer=google_dot_ads_dot_googleads__v3_dot_proto_dot_services_dot_google__ads__service__pb2.SearchGoogleAdsStreamResponse.SerializeToString,
      ),
      'Mutate': grpc.unary_unary_rpc_method_handler(
          servicer.Mutate,
          request_deserializer=google_dot_ads_dot_googleads__v3_dot_proto_dot_services_dot_google__ads__service__pb2.MutateGoogleAdsRequest.FromString,
          response_serializer=google_dot_ads_dot_googleads__v3_dot_proto_dot_services_dot_google__ads__service__pb2.MutateGoogleAdsResponse.SerializeToString,
      ),
  }
  generic_handler = grpc.method_handlers_generic_handler(
      'google.ads.googleads.v3.services.GoogleAdsService', rpc_method_handlers)
  server.add_generic_rpc_handlers((generic_handler,)) 
开发者ID:googleads,项目名称:google-ads-python,代码行数:23,代码来源:google_ads_service_pb2_grpc.py

示例8: add_SubscriberServicer_to_server

# 需要导入模块: import grpc [as 别名]
# 或者: from grpc import unary_stream_rpc_method_handler [as 别名]
def add_SubscriberServicer_to_server(servicer, server):
    rpc_method_handlers = {
        'receive': grpc.unary_stream_rpc_method_handler(
            servicer.receive,
            request_deserializer=SubscriptionRequest.FromString,
            response_serializer=Message.SerializeToString,
        ),
        'receiveWithAcks': grpc.stream_stream_rpc_method_handler(
            servicer.receiveWithAcks,
            request_deserializer=SubscriptionResponse.FromString,
            response_serializer=Message.SerializeToString,
        ),
        'subscribe': grpc.stream_stream_rpc_method_handler(
            servicer.subscribe,
            request_deserializer=SubscriptionAcks.FromString,
            response_serializer=SubscriptionMessage.SerializeToString,
        ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
        'predix.eventhub.Subscriber', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,)) 
开发者ID:PredixDev,项目名称:predixpy,代码行数:23,代码来源:EventHub_pb2.py

示例9: add_SubscriberServicer_to_server

# 需要导入模块: import grpc [as 别名]
# 或者: from grpc import unary_stream_rpc_method_handler [as 别名]
def add_SubscriberServicer_to_server(servicer, server):
  rpc_method_handlers = {
      'receive': grpc.unary_stream_rpc_method_handler(
          servicer.receive,
          request_deserializer=EventHub__pb2.SubscriptionRequest.FromString,
          response_serializer=EventHub__pb2.Message.SerializeToString,
      ),
      'receiveWithAcks': grpc.stream_stream_rpc_method_handler(
          servicer.receiveWithAcks,
          request_deserializer=EventHub__pb2.SubscriptionResponse.FromString,
          response_serializer=EventHub__pb2.Message.SerializeToString,
      ),
      'subscribe': grpc.stream_stream_rpc_method_handler(
          servicer.subscribe,
          request_deserializer=EventHub__pb2.SubscriptionAcks.FromString,
          response_serializer=EventHub__pb2.SubscriptionMessage.SerializeToString,
      ),
  }
  generic_handler = grpc.method_handlers_generic_handler(
      'predix.eventhub.Subscriber', rpc_method_handlers)
  server.add_generic_rpc_handlers((generic_handler,)) 
开发者ID:PredixDev,项目名称:predixpy,代码行数:23,代码来源:EventHub_pb2_grpc.py

示例10: add_MockServiceServicer_to_server

# 需要导入模块: import grpc [as 别名]
# 或者: from grpc import unary_stream_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

示例11: _wrap_rpc_behavior

# 需要导入模块: import grpc [as 别名]
# 或者: from grpc import unary_stream_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

示例12: add_DebugServicer_to_server

# 需要导入模块: import grpc [as 别名]
# 或者: from grpc import unary_stream_rpc_method_handler [as 别名]
def add_DebugServicer_to_server(servicer, server):
  rpc_method_handlers = {
      'Dump': grpc.unary_stream_rpc_method_handler(
          servicer.Dump,
          request_deserializer=client_dot_debug_dot_debug__pb2.DumpRequest.FromString,
          response_serializer=google_dot_protobuf_dot_wrappers__pb2.BytesValue.SerializeToString,
      ),
      'Profile': grpc.unary_stream_rpc_method_handler(
          servicer.Profile,
          request_deserializer=client_dot_debug_dot_debug__pb2.ProfileRequest.FromString,
          response_serializer=google_dot_protobuf_dot_wrappers__pb2.BytesValue.SerializeToString,
      ),
      'Binary': grpc.unary_stream_rpc_method_handler(
          servicer.Binary,
          request_deserializer=client_dot_debug_dot_debug__pb2.BinaryRequest.FromString,
          response_serializer=google_dot_protobuf_dot_wrappers__pb2.BytesValue.SerializeToString,
      ),
  }
  generic_handler = grpc.method_handlers_generic_handler(
      'debug.Debug', rpc_method_handlers)
  server.add_generic_rpc_handlers((generic_handler,)) 
开发者ID:pachyderm,项目名称:python-pachyderm,代码行数:23,代码来源:debug_pb2_grpc.py

示例13: add_TransferServiceServicer_to_server

# 需要导入模块: import grpc [as 别名]
# 或者: from grpc import unary_stream_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

示例14: add_WisdomServicer_to_server

# 需要导入模块: import grpc [as 别名]
# 或者: from grpc import unary_stream_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

示例15: add_InvoicesServicer_to_server

# 需要导入模块: import grpc [as 别名]
# 或者: from grpc import unary_stream_rpc_method_handler [as 别名]
def add_InvoicesServicer_to_server(servicer, server):
  rpc_method_handlers = {
      'SubscribeSingleInvoice': grpc.unary_stream_rpc_method_handler(
          servicer.SubscribeSingleInvoice,
          request_deserializer=lnd__grpc_dot_protos_dot_invoices__pb2.SubscribeSingleInvoiceRequest.FromString,
          response_serializer=lnd__grpc_dot_protos_dot_rpc__pb2.Invoice.SerializeToString,
      ),
      'CancelInvoice': grpc.unary_unary_rpc_method_handler(
          servicer.CancelInvoice,
          request_deserializer=lnd__grpc_dot_protos_dot_invoices__pb2.CancelInvoiceMsg.FromString,
          response_serializer=lnd__grpc_dot_protos_dot_invoices__pb2.CancelInvoiceResp.SerializeToString,
      ),
      'AddHoldInvoice': grpc.unary_unary_rpc_method_handler(
          servicer.AddHoldInvoice,
          request_deserializer=lnd__grpc_dot_protos_dot_invoices__pb2.AddHoldInvoiceRequest.FromString,
          response_serializer=lnd__grpc_dot_protos_dot_invoices__pb2.AddHoldInvoiceResp.SerializeToString,
      ),
      'SettleInvoice': grpc.unary_unary_rpc_method_handler(
          servicer.SettleInvoice,
          request_deserializer=lnd__grpc_dot_protos_dot_invoices__pb2.SettleInvoiceMsg.FromString,
          response_serializer=lnd__grpc_dot_protos_dot_invoices__pb2.SettleInvoiceResp.SerializeToString,
      ),
  }
  generic_handler = grpc.method_handlers_generic_handler(
      'invoicesrpc.Invoices', rpc_method_handlers)
  server.add_generic_rpc_handlers((generic_handler,)) 
开发者ID:willcl-ark,项目名称:lnd_grpc,代码行数:28,代码来源:invoices_pb2_grpc.py


注:本文中的grpc.unary_stream_rpc_method_handler方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。