For this sample, we've already generated the server and client stubs from helloworld.proto and we'll be using a specific reference platform.
Install gRPC:
$ pip install grpcio
Or, to install it system wide:
$ sudo pip install grpcio
If you're on Windows, make sure you installed the pip.exe
component when you installed Python. Invoke as above but with pip.exe
instead of pip
(you may also need to invoke from a cmd.exe
ran as administrator):
$ pip.exe install grpcio
Download the example
$ # Clone the repository to get the example code: $ git clone https://github.com/grpc/grpc $ # Navigate to the "hello, world" Python example: $ cd grpc/examples/python/helloworld
Run the server
$ python2.7 greeter_server.py &
Run the client
$ python2.7 greeter_client.py
You can find a more detailed tutorial in gRPC Basics: Python