Skip to content

Cannot convert response message to JSON #18

Description

@tdiesler
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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions