Index

Getting set up

Example gRPC Project with tutorial and documentation

Create your Proto files

Generating gRPC Code from Proto files

Creating your Server

Creating your Client

Getting set up

Follow this quick start guide for setting up gRPC and the python protoc compiler

Quick start

Example gRPC Project with tutorial and documentation

https://github.com/Are-Oelsner/gRPC-Gateway

Create your Proto files

Define your service(s) and their rpc(s)

Define any message types used in the rpc(s)

Generating gRPC Code from Proto files

# <python protoc compiler> -I<path to protos folder> --python_out=<path to new pb2 file> --grpc_python_out=<path to new pb2_grpc file> <path to proto file>

# gRPC Gateway Example 
$ python -m grpc_tools.protoc -I./protos --python_out=./python --grpc_python_out=./python ./protos/gateway.proto

# gRPC HelloWorld Example
$ python -m grpc_tools.protoc -I../../protos --python_out=. --grpc_python_out=. ../../protos/helloworld.proto

Creating your Server

Now that you have your proto file compiled into project-name_pb2 and project-name_pb2_grpc files, we can start to create our server. The project-name_pb2_grpc file defines a sub class that we’ll use to implement our client, and a Servicer class that we’ll use for our server.