Example gRPC Project with tutorial and documentation
Generating gRPC Code from Proto files
Follow this quick start guide for setting up gRPC and the python protoc compiler
https://github.com/Are-Oelsner/gRPC-Gateway
Define your service(s) and their rpc(s)
Define any message types used in the rpc(s)
# <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
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.