我有这样的格式,想把我的 python dict 转换成这个 proto 格式的 proto 代码:
message template{
message NicSettings{
string network_adapter = 1;
string network_name = 2;
}
message NetConfig{
bool keep_mac_address =1;
bool same_as_source = 2;
repeated NicSettings nic_settings = 3;
}
NetworkConfig network_config = 3;
}
蟒蛇字典:
template:
{ keepMacAddress: true,
sameAsSource : false,
nicSettings: [ {networkAdapter: "ethernet0",
networkName: "Calpal1"
} ,
{networkAdapter: "ethernet1",
networkName: "Calpal2"
}
]
}
如何将其转换为原始消息以将其传递给 gRPC。