The doc's aren't very clear about this, but msgpack.unpackb
is a "one-shot" unpacker - you can't give it a larger stream with extra data in it. I assume that you are getting multiple msgpack objects and you can read them with msgpack.Unpacker
as in
r1=requests.get('http://localhost:3000/fs?path='+r.json()['object'])
for unp in msgpack.unpackb(r1.content):
do something...
The reason for this is that the msgpack
deserializer reads data in chunks for greater efficiency. For unpackb
, where you can only return one object, its chunk reader consumed more of the data stream than it should have and you lost data.