blob: a0aeb47bd72f9ce3a306f8e9814a712788734e3f [file] [log] [blame]
Jan Tattermusch7897ae92017-06-07 22:57:36 +02001# Copyright 2015 gRPC authors.
Jan Tattermusch7dfd4ab2015-02-25 15:00:46 -08002#
Jan Tattermusch7897ae92017-06-07 22:57:36 +02003# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
Jan Tattermusch7dfd4ab2015-02-25 15:00:46 -08006#
Jan Tattermusch7897ae92017-06-07 22:57:36 +02007# http://www.apache.org/licenses/LICENSE-2.0
Jan Tattermusch7dfd4ab2015-02-25 15:00:46 -08008#
Jan Tattermusch7897ae92017-06-07 22:57:36 +02009# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
Jan Tattermusch7dfd4ab2015-02-25 15:00:46 -080014"""The Python implementation of the GRPC helloworld.Greeter client."""
15
Leifur Halldor Asgeirsson4df39872016-03-03 10:37:31 -050016from __future__ import print_function
17
Nathaniel Manista46585e22016-07-15 22:33:50 +000018import grpc
Nathaniel Manista061d2882015-09-08 21:34:33 +000019
Jan Tattermusch7dfd4ab2015-02-25 15:00:46 -080020import helloworld_pb2
Nathaniel Manistac15ee832016-12-15 22:58:29 +000021import helloworld_pb2_grpc
Jan Tattermusch7dfd4ab2015-02-25 15:00:46 -080022
Jan Tattermusch7dfd4ab2015-02-25 15:00:46 -080023
24def run():
ncteisen848a7492017-12-12 10:31:47 -080025 channel = grpc.insecure_channel('localhost:50051')
26 stub = helloworld_pb2_grpc.GreeterStub(channel)
27 response = stub.SayHello(helloworld_pb2.HelloRequest(name='you'))
28 print("Greeter client received: " + response.message)
Jan Tattermusch7dfd4ab2015-02-25 15:00:46 -080029
30
31if __name__ == '__main__':
ncteisen848a7492017-12-12 10:31:47 -080032 run()