问题描述
我正在尝试从后端获取的protobuf base64消息中读取数据。
我的字符串是'AAAAAA8KDQgTEBUgBCjln62lxS6AAAAAD2dycGMtc3RhdHVzOjANCg =='
所以,我在下面创建了原始文件。
Syntax = "proto2";
//protoc -I=. --python_out=. ./message.proto
message ArtifactList {
repeated Artifact artifacts = 1;
required bool grpcStatus = 2;
}
message Artifact {
required string id = 1;
required string type_id = 2;
required string uri = 3;
}
import message_pb2
import base64
base64_message = 'AAAAAA8KDQgTEBUgBCjln62lxS6AAAAAD2dycGMtc3RhdHVzOjANCg=='
message_bytes = base64.b64decode(base64_message)
artifactList = message_pb2.ArtifactList()
artifactList.ParseFromString(message_bytes)
print(artifactList)
print(message_bytes)
RuntimeWarning: Unexpected end-group tag: Not all data was converted
artifactList.ParseFromString(message_bytes)
任何人都可以帮助解决此问题吗?
预先感谢
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)