Cannot convert response message to JSON
Opened this issue · 1 comments
tdiesler commented
import grpc
import osmosis_protobuf.osmosis.gamm.v1beta1.query_pb2_grpc as query_grpc
import osmosis_protobuf.osmosis.gamm.v1beta1.query_pb2 as query
from google.protobuf.json_format import MessageToJson
c = grpc.insecure_channel('grpc.osmosis.zone:9090')
stub = query_grpc.QueryStub(c)
res: query.QueryPoolResponse = stub.Pool(query.QueryPoolRequest(pool_id=708))
res = MessageToJson(res)
gives ...
except KeyError as e:
> raise TypeError(
'Can not find message descriptor by type_url: {0}'.format(type_url)
) from e
E TypeError: Can not find message descriptor by type_url: /osmosis.gamm.v1beta1.Pool
MessageToDict
fails in the same way.
How would I read the nested content of QueryPoolResponse?
cheers
I can do ...
grpcurl -plaintext -d '{"pool_id": 704}' grpc.osmosis.zone:9090 osmosis.gamm.v1beta1.Query.Pool | jq
tdiesler commented
I'm using osmosis-protobuf-0.3.1