Skip to content

Instantly share code, notes, and snippets.

@gistlyn gistlyn/main.py
Created Dec 30, 2019

Embed
What would you like to do?
Python Google protoc SSL GrpcServicesClient TodoWorld Example
import grpc
import services_pb2
import services_pb2_grpc
def run():
with open('grpc.crt', 'rb') as f:
credentials = grpc.ssl_channel_credentials(f.read())
with grpc.secure_channel('todoworld.servicestack.net:50051', credentials) as channel:
client = services_pb2_grpc.GrpcServicesStub(channel)
response = client.GetHello(services_pb2.Hello(Name="gRPC Python"))
print(response.Result)
if __name__ == '__main__':
run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.