I need to parse a protocol buffer send via a post using bottle.
How do I get PB to parse?
I tried the following but did nt work:
@post('/test')
def test():
br = test_pb2.MyRequest()
br.ParseFromString(request.files.data)
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The raw body data is available through
request.body, a file-like object (either a real file or a BytesIO depending on its size).request.body.read()should do the job for you.