Openfire的XMPPPY
我正在尝试把XMPPPY连接到Openfire,发送一条消息,然后关闭连接。问题是我总是遇到以下错误:
(Python 2.6)
import xmpp
pwd = "password"
jid=xmpp.protocol.JID("testuser@localhost")
cl=xmpp.Client(jid.getDomain()) #这会变成'localhost'
cl.connect()
DEBUG: socket start Plugging <xmpp.transports.TCPsocket instance at 0x190ea1b8> into <xmpp.client.Client instance at 0x190e5320>
DEBUG: socket start Successfully connected to remote host ('localhost', 5222)
DEBUG: dispatcher start Plugging <xmpp.dispatcher.Dispatcher instance at 0x190ea2d8> into <xmpp.client.Client instance at 0x190e5320>
cl.auth(jid.getNode(),pwd) #这会变成'testuser' / 'password'
DEBUG: sasl error Failed SASL authentification: <not-authorized />
DEBUG: sasl stop Plugging <xmpp.auth.SASL instance at 0x190f0320> out of <xmpp.client.Client instance at 0x190e5320>.
我百分之百确定用户名和密码是正确的,因为我试过很多次,并且可以通过Spark成功连接。
有没有什么设置我遗漏了?或者有没有人成功过?
1 个回答
0
查一下你的jid格式
jid=xmpp.protocol.JID("testuser@localhost")
xmpp服务器的名字应该和'@'后面的名字一样
可以在这个链接查看xmpp服务器的名字:http://localhost:9090/index.jsp