aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples/python/README.md
blob: 9992baa84217a3dd7d9f7c42ccad40df56a2bb97 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
gRPC in 3 minutes (Python)
========================

Background
-------------
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:
```sh
  $ pip install grpcio
```
Or, to install it system wide:
```sh
  $ 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):
```sh
  $ pip.exe install grpcio
```

Download the example
```sh
  $ # 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
  ```

Try it!
-------

- Run the server

  ```sh
  $ python2.7 greeter_server.py &
  ```

- Run the client

  ```sh
  $ python2.7 greeter_client.py
  ```

Tutorial
--------

You can find a more detailed tutorial in [gRPC Basics: Python][]

[helloworld.proto]:../protos/helloworld.proto
[Install gRPC Python]:../../src/python#installation
[gRPC Basics: Python]:http://www.grpc.io/docs/tutorials/basic/python.html