问题
I am rewriting the following Perl code in Python:
my $data = Data::AMF::Packet->new->deserialize($packet);
$data->messages->[0]->{value}->[1] = $data->messages->[1]->{value}->[1] = $mid;
$data = $data->serialize;
I would like to know how to write this in Python? I am new to PyAMF and the examples I googled wont help.
Thanks a lot!
回答1:
Something along the lines of:
from pyamf import remoting
packet = remoting.decode(bytes)
packet['/1'][1] = packet['/2'][1]
stream = remoting.encode(packet)
bytes = stream.getvalue()
来源:https://stackoverflow.com/questions/6920799/how-to-deserialize-and-serialize-amf-packets-in-python