我正在为我的 jabber 远程管理机器人使用 xmpppy 库,但我找不到如何发送/接收文件并将其保存在指定的目录中。文档很差,也没有任何示例,但我真的很想制作它。任何人都可以展示一些示例或一些有关它的链接吗?或者也许我应该使用替代的 xmpp 绑定?
I'm using xmpppy library for my jabber remote administration bot, but I can't find how to send/receive a file and save it inside the directory specified. The documentation is poor and there isn't any examples, but I really want to make it. Can anyone show some examples or some links about it? Or maybe I should use an alternative xmpp bindings?
发布评论
评论(2)
有两个涵盖文件传输的 XEP(XMPP 扩展): XEP-0096 http://xmpp。 org/extensions/xep-0096.html(称为 SI(流启动)文件传输)和 XEP-0234 http://xmpp.org/extensions/xep-0234.html(Jingle 文件传输)
XEP-0096 是原始版本,但我发现它很少实现(正如您所发现的)在大多数图书馆和大多数客户中。 XEP-0234 更新得多,可以在更现代的客户端中找到,但不能在较旧的库(如 xmpppy)中找到。即使您找到其中任何一个的库或实现,您也将面临的问题是连接的双方也必须实现它们。
在这两者中,我会选择 XEP-0234,因为它涵盖了原始版本存在的相当多的问题,并且被认为是它的替代品。
就 Python 库而言,没有一个库支持它。我看过 xmpppy、headstock、pyxmpp、jabber.py、twisted Words 和我最喜欢的 smoothxmppp。
There are two XEP's (XMPP Extensions) that cover file transfer: XEP-0096 http://xmpp.org/extensions/xep-0096.html (called SI (Stream Initiated) File Transfer) and XEP-0234 http://xmpp.org/extensions/xep-0234.html (Jingle File Transfer)
XEP-0096 is the original one but I have found it is rarely implemented (as you have discovered) in most libraries and also most clients. XEP-0234 is much newer and is found in more modern clients but not in older libraries (like xmpppy). The problem you are going to face even when you find a library or implementation of either of these is that both sides of the connection must also implement them.
Of the two, I would pick XEP-0234 because it covers quite a few issues that the original had and is considered to be the replace for it.
As far as Python libraries go none support it. I've looked at xmpppy, headstock, pyxmpp, jabber.py, twisted words and my favourite sleekxmppp.
xmpppy中有一个模块xmpp.filetransfer:
There is a module xmpp.filetransfer in xmpppy: