Nathaniel Manista | 4e7ea93 | 2015-10-07 14:34:08 +0000 | [diff] [blame] | 1 | gRPC in 3 minutes (Python) |
| 2 | ======================== |
| 3 | |
| 4 | Background |
| 5 | ------------- |
| 6 | For this sample, we've already generated the server and client stubs from |
| 7 | [helloworld.proto][] and we'll be using a specific reference platform. |
| 8 | |
Nathaniel Manista | 4e7ea93 | 2015-10-07 14:34:08 +0000 | [diff] [blame] | 9 | |
Stanley Cheung | e8130a1 | 2016-02-16 21:13:18 -0800 | [diff] [blame] | 10 | Install gRPC: |
Nathaniel Manista | 4e7ea93 | 2015-10-07 14:34:08 +0000 | [diff] [blame] | 11 | ```sh |
Stanley Cheung | e8130a1 | 2016-02-16 21:13:18 -0800 | [diff] [blame] | 12 | $ pip install grpcio |
| 13 | ``` |
| 14 | Or, to install it system wide: |
| 15 | ```sh |
| 16 | $ sudo pip install grpcio |
| 17 | ``` |
| 18 | |
| 19 | Download the example |
| 20 | ```sh |
Nathaniel Manista | 4e7ea93 | 2015-10-07 14:34:08 +0000 | [diff] [blame] | 21 | $ # Clone the repository to get the example code: |
| 22 | $ git clone https://github.com/grpc/grpc |
| 23 | $ # Navigate to the "hello, world" Python example: |
| 24 | $ cd grpc/examples/python/helloworld |
| 25 | ``` |
| 26 | |
| 27 | Try it! |
| 28 | ------- |
| 29 | |
| 30 | - Run the server |
| 31 | |
| 32 | ```sh |
| 33 | $ python2.7 greeter_server.py & |
| 34 | ``` |
| 35 | |
| 36 | - Run the client |
| 37 | |
| 38 | ```sh |
| 39 | $ python2.7 greeter_client.py |
| 40 | ``` |
| 41 | |
| 42 | Tutorial |
| 43 | -------- |
| 44 | |
| 45 | You can find a more detailed tutorial in [gRPC Basics: Python][] |
| 46 | |
| 47 | [helloworld.proto]:../protos/helloworld.proto |
| 48 | [Install gRPC Python]:../../src/python#installation |
| 49 | [gRPC Basics: Python]:http://www.grpc.io/docs/tutorials/basic/python.html |