Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要使用瓶子解析通过帖子发送的协议缓冲区。
如何让 PB 解析?
我尝试了以下但没有工作:
@post('/test') def test(): br = test_pb2.MyRequest() br.ParseFromString(request.files.data)
原始正文数据可通过request.body类文件对象(根据其大小可以是真实文件或 BytesIO)获得。request.body.read()应该为你做这项工作。
request.body
request.body.read()