本文整理汇总了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,))
示例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,))
示例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,))
示例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.
示例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.
示例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.
示例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,))
示例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,))
示例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,))
示例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,))
示例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
)
示例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,))
示例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,))
示例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,))
示例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,))