简体   繁体   中英

python - how register user with xmpp

I'm trying to register a new user, but not work. I get the following error:

AttributeError: Client instance has no attribute 'SendAndWaitForResponse'

this is my code:

import xmpp, sys
usuario = 'test1@localhost'
password = 'mypassword'
jid = xmpp.JID(usuario)
cli = xmpp.Client(jid.getDomain(), debug=[])
cli.connect()

if xmpp.features.register(cli,jid.getDomain(),{'username':jid.getNode(),'password':password}):
    sys.stderr.write('Success\n')
    sys.exit(0)
else:
    sys.stderr.write('Error\n')
    sys.exit(1)

i use linux

I also met this issue. When you remove "debug=[]" from the connect param list. You can get the debug output. In my side, this issue is because the server can not be reached.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM