How to deserialize and serialize AMF Packets in Python?

点点圈 提交于 2020-01-17 05:18:14

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!