I'm a newbie to protobufs and I can't seem to get it. I have a proto file like this.
message Address{
string Home=1;
State state=2;
string Name=3;
enum State{
STATE_UNKNOWN=0;
STATE_ARCHIVED=1;
}
}
And I've added data to the message that looks like this.
Address{
Home:"Cornfield";
State: STATE_UNKNOWN;
Name:"Corner";
}
Address{
Home:"Ham";
State: STATE_UNKNOWN;
Name:"Hammer";
}
data = Address.getfielddescriptor() The field descriptor method can't return a list of values like data=['Cornfield','Ham']
How would I do this?
For you to be able to use a list you need to define a field as repeated. So somewhere you need to define something like an Address Book where you store all your addresses:
Next in python you use this as followed:
Other methods of extending the address book can be found in the protobuf documentation here.