Pycharm 中的 Protobuf 响应类型无法识别

问题描述 投票:0回答:0

我在使用下面的时候,可以得到response,是有效的。响应类型正确。在 PyCharm 中,我希望能够键入“响应”。并点击“ctrl+enter”并看到弹出的“response.count”选项。生成了 .pyi 文件并且似乎有合适的插槽。

with grpc.insecure_channel(‘localhost:4443’) as channel:
     stub = SERVICESgrpc.CountServiceStub(channel)
     response = stub.GetCount(SERVICES.CountRequest())
     print(type(response))
     #the above line prints that the type is a CountResponse - how do I make my IDE recognize that 

我试着给回应一个类型

    with grpc.insecure_channel(‘localhost:4443’) as channel:
         stub = SERVICESgrpc.CountServiceStub(channel)
         response = SERVICES.CountResponse()
         #response.count autocompletes here
         response = stub.GetCount(SERVICES.CountRequest())
         #prints that the type is a CountResponse - how do I make my IDE recognize that
         print(type(response))
         #works, but will not auto-complete response.count
         print(response.count)
python pycharm protocol-buffers
© www.soinside.com 2019 - 2024. All rights reserved.