【发布时间】:2019-07-16 06:22:46
【问题描述】:
我正在尝试编写一个 python 客户端来终止一个 gRPC 流
原型:
rpc Start (StartParameters) returns (stream Progress) {}
在客户端中,当我准备好终止流时,我尝试调用 stream.cancel(),然后当我打印捕获的流的事件时,它不会打印事件。我看到了异常
<_Rendezvous of RPC that terminated with:
status = StatusCode.CANCELLED
details = "Locally cancelled by application!"
debug_error_string = "None"
client.py
stream = self.stub.Start(params)
time.sleep(120)
stream.cancel()
for event in stream:
print(event)
有人可以帮我用 python 代码取消这个流并打印流中的事件吗?
【问题讨论】:
标签: python grpc grpc-python