Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot convert response message to JSON #18

Open
tdiesler opened this issue Aug 11, 2023 · 1 comment
Open

Cannot convert response message to JSON #18

tdiesler opened this issue Aug 11, 2023 · 1 comment

Comments

@tdiesler
Copy link

tdiesler commented Aug 11, 2023

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
Copy link
Author

I'm using osmosis-protobuf-0.3.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant