Getting the payload of a protocol buffer post

26 views
Skip to first unread message

David Montgomery

unread,
May 25, 2012, 11:54:23 AM5/25/12
to python-...@googlegroups.com
Hi,

I have protocola buffers send as a post. How to I get the payload so
I can parse?

payload = ??????
mypb = mypb_pb2.BufferTestt()
mypb.ParseFromString(payload)


Thanks

Jon Parise

unread,
May 25, 2012, 12:31:13 PM5/25/12
to python-...@googlegroups.com
Here's some code that I've used in the past: https://gist.github.com/2789026

Then you would call:

message = self.read_protobuf(BufferTest, self.request.body)

The accepts() method just checks whether the given MIME type appears
in the client's Accept: header.
Reply all
Reply to author
Forward
0 new messages