本文整理汇总了Python中zeroless.Client.request方法的典型用法代码示例。如果您正苦于以下问题:Python Client.request方法的具体用法?Python Client.request怎么用?Python Client.request使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类zeroless.Client
的用法示例。
在下文中一共展示了Client.request方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Client
# 需要导入模块: from zeroless import Client [as 别名]
# 或者: from zeroless.Client import request [as 别名]
from zeroless import Client
# Connects the client to as many servers as desired
client = Client()
client.connect_local(port=12345)
# Initiate a request client
# And assigns a callable and an iterable
# To both transmit and wait for incoming messages
request, listen_for_reply = client.request()
for id, msg in [(b"1", b"Msg1"), (b"2", b"Msg2"), (b"3", b"Msg3")]:
request(id, msg)
response = next(listen_for_reply)
print(response)
示例2: request_gens
# 需要导入模块: from zeroless import Client [as 别名]
# 或者: from zeroless.Client import request [as 别名]
def request_gens():
client = Client()
client.connect_local(port=7892)
return client.request()