Created
December 30, 2019 23:49
-
-
Save gistlyn/e90edd8a6c35287d69c614e7340481d1 to your computer and use it in GitHub Desktop.
Python Google protoc SSL GrpcServicesClient TodoWorld Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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