如何使用以下方法使用xmpppy发送数据:http://xmpp.org/extensions/xep-0047.html#send
我想我应该使用IBB类,但不知道怎么做。http://xmpppy.sourceforge.net/apidocs/
发布于 2012-07-11 14:28:31
首先,如果你使用GoogleTalk,确保发送者在接收者的花名册上。接下来,在发送方:
from xmpp import *
cl=Client('example.com')
cl.connect()
cl.auth('sender', 'sender_pass')
ibb = filetransfer.IBB()
ibb.PlugIn(cl)
f = open('/tmp/foo')
ibb.OpenStream('123', 'receiver@example.com/resource', f)如果您没有首先正确地执行XEP-95/XEP-96,那么流ID是什么都无关紧要。
发布于 2012-07-11 17:26:50
我认为是这样的:
import StringIO
...
output = StringIO.StringIO()
output.write('String data')
output.close()
client.OpenStream('123', 'receiver@example.com/resource', output)https://stackoverflow.com/questions/11410171
复制相似问题