grpc python3

安装

1
$ pip3 install grpcio

示例

1
2
3
4
5
import grpc
channel = grpc.insecure_channel('localhost:8000')
grpc.channel_ready_future(self.channel).result(10) # 等待 channel ready, 超时 10s
stub = EchoServiceGRPC.EchoServiceStub(self.channel) # 创建 stub
stub.ping('pong') # 远程调用