-
Notifications
You must be signed in to change notification settings - Fork 1
3. Develop a simple client
Florian Vansteene edited this page Jul 2, 2017
·
2 revisions
You can use different langage to implement the client with Protobuf. For the example, i will show you how to create a simple client in Python.
There are an example of simple client in Python with gRPC/Protobuf here
$ python -m pip install grpcio
$ python -m pip install grpcio-tools
Your protobuf file must to be in the folder protos, and must be the same as the server's protobuf file. For the example the file is helloworld.proto
syntax = "proto3";
package example;
service HelloWorldService {
rpc SayHello (InitTransactionRequest) returns (FitnessResponse) {}
}
message HelloRequest {
string message = 1;
}
message HelloResponse {
string message = 2;
}
$ python -m grpc_tools.protoc -I=. --python_out=. --grpc_python_out=. protos/helloworld.proto
Now we need to implement the new service. In you're client import the new grpc service :
from protos import helloworld_pb2_grpc
from protos import helloworld_pb2
Your can found the current client pour this project here : florianva/RoAPIClientPython