如何使用Python通过XMPP传输文件? [英] How can I transfer a file via XMPP using Python?

查看:154
本文介绍了如何使用Python通过XMPP传输文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为jabber远程管理bot使用 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?

推荐答案

涉及文件传输的两种XEP(XMPP扩展名):XEP-0096

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是原始版本,但我发现它在大多数库和大多数客户端中都很少实现(如您所发现的). XEP-0234较新,可以在更现代的客户端中找到,而在较旧的库(如xmpppy)中则找不到.即使您找到其中的任何一个库或实现,您仍将面临的问题是连接的两端也必须实现它们.

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.

在这两个示例中,我会选择XEP-0234,因为它涵盖了原先存在的许多问题,并被认为可以替代原先的问题.

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.

就Python库而言,没有一个库支持它.我看过xmpppy,床头柜,pyxmpp,jabber.py,扭曲的单词和我最喜欢的sleekxmppp.

As far as Python libraries go none support it. I've looked at xmpppy, headstock, pyxmpp, jabber.py, twisted words and my favourite sleekxmppp.

这篇关于如何使用Python通过XMPP传输文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆