flask 中如何调用 grpc

# 这是 flask 中的一个 route@app.route('/test')def test():  # 同样的方法,放到了flask中,就会卡在发送数据的那个地方
  send_grpc()# 这段,放到 __main__ 下跑,是没问题的def send_grpc():
  channel = grpc.insecure_channel('server_host')
  client = something_pb2_grpc.SomethingStub(channel=channel)  # 在flask中会卡在这个地方
  res = client.SayHello(
    something_pb2.Hellp(word='')
  )
  print res

有没有哪位知道这是为什么,是flask和grpc不兼容吗?
请问有没有什么解决方案。


噜噜哒
浏览 1349回答 1
1回答
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Python