是否可以使用python指定每次grpc调用的超时时间。 我收到回复的时间超过了1分钟。 如果要花费更长的时间,我希望api返回一些错误。我正在使用阻止grpc的呼叫。
答案 0 :(得分:0)
您可以在gRPC Python的API reference中查找所需的信息。设置超时应该很简单:
channel = grpc.insecure_channel(...)
stub = ...(channel)
stub.AnRPC(request, timeout=5) # 5 seconds timeout