Skip to content

Instantly share code, notes, and snippets.

@gistlyn
Created December 30, 2019 23:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gistlyn/e90edd8a6c35287d69c614e7340481d1 to your computer and use it in GitHub Desktop.
Save gistlyn/e90edd8a6c35287d69c614e7340481d1 to your computer and use it in GitHub Desktop.
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