构建原型对象时,“TypeError:无法分配给扩展“actionRequest”,因为它是重复或复合类型。”
原型文件:
message Message{
message MessageContent{
extensions 100 to max;
}
optional MessageContent content = 1;
}
message ActionRequest{
optional string token = 1;
}
extend Message.MessageContent {
optional ActionRequest actionRequest = 200;
}
代码:
import TestPb_pb2
message = TestPb_pb2.Message()
request = TestPb_pb2.ActionRequest()
message.content.Extensions[TestPb_pb2.actionRequest] = request