Simple RPC with Protobuf Services
Go to file
Luke Murphy 78d9edb91e
continuous-integration/drone/push Build is failing Details
Add drone config
2020-08-09 01:34:56 +02:00
hrpc Init hrpc 2020-08-09 01:33:07 +02:00
.drone.yml Add drone config 2020-08-09 01:34:56 +02:00
.gitignore Init hrpc 2020-08-09 01:33:07 +02:00
CHANGELOG.md Init hrpc 2020-08-09 01:33:07 +02:00
LICENSE Init hrpc 2020-08-09 01:33:07 +02:00
README.md Init hrpc 2020-08-09 01:33:07 +02:00
pyproject.toml Init hrpc 2020-08-09 01:33:07 +02:00

README.md

hrpc

Simple RPC with Protobuf Services

Install

$ pip install hrpc

Example

Define an RPC service in a schema.proto.

message Echo {
  required string value = 1;
}

service Example {
  rpc Echo (Echo) returns (Echo) {}
}

Then generate the services and stubs with hrpc.

$ pip install hrpc
$ hrpc schema.proto

This creates schema_gprc.py (services) and schema_pb2.py (stubs) files.

You can write a simple server and client like so.

# server.py
# client.py

Then run them in separate terminals and see the output.

$ python server.py # terminal 1
$ python client.py # terminal 2