Ejabberd和Python3

时间:2019-02-01 11:15:51

标签: xml python-3.x ejabberd

尝试将ejabberd与python软件包pyejabberd连接时出现语法错误。

错误是错误-

<?xml version='1.0'?><stream:stream id='12042217178057076392' version='1.0' xml:lang='en' xmlns:stream='http://etherx.jabber.org/streams' xmlns='jabber:client'><stream:error><not-well-formed xmlns='urn:ietf:params:xml:ns:xmpp-streams'/><text xml:lang='en' xmlns='urn:ietf:params:xml:ns:xmpp-streams'>syntax error</text></stream:error></stream:stream>

代码:

from pyejabberd import EjabberdAPIClient

client = EjabberdAPIClient(host='127.0.0.1', port=5222,
                       username='admin@arojit.com', password='arojit',
                       user_domain='arojit.com',
                       protocol='http')

try:
    registered_users = client.registered_users('arojit.com')
except Exception as e:
    print(e)

1 个答案:

答案 0 :(得分:0)

我猜用户名应该是“ admin”,而不是“ admin@arojit.com”。