Reputation: 78254
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)
Upvotes: 3
Views: 1487
Reputation: 4199
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.
Upvotes: 5