當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。