简体   繁体   English

如何在Python中反序列化和序列化AMF数据包?

[英]How to deserialize and serialize AMF Packets in Python?

I am rewriting the following Perl code in Python: 我正在用Python重写以下Perl 代码

  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? 我想知道如何用Python编写此代码? I am new to PyAMF and the examples I googled wont help. 我是PyAMF的新手,我用Google搜索的示例也无济于事。

Thanks a lot! 非常感谢!

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()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM