Skip to content

Instantly share code, notes, and snippets.

@wfng92
Created September 8, 2022 07:50
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wfng92/a036bf4c1c38e2dc65098610511063bc to your computer and use it in GitHub Desktop.
Save wfng92/a036bf4c1c38e2dc65098610511063bc to your computer and use it in GitHub Desktop.
import logging
import os
import grpc
from protos import hello_pb2, hello_pb2_grpc
def run():
with grpc.insecure_channel('localhost:50051') as channel:
stub = hello_pb2_grpc.GreeterStub(channel)
response = stub.SayHello(hello_pb2.HelloRequest(name='John Doe', age=30))
print("Greeter client received: " + response.message)
if __name__ == '__main__':
logging.basicConfig()
run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment