Witam. Mam taki oto kod:
#!/usr/bin/env python
import sys,os,xmpp,time
jid=xmpp.protocol.JID('[email protected]')
cl=xmpp.Client(jid.getDomain(),debug=[])
con=cl.connect()
if not con:
print 'could not connect!'
sys.exit()
print 'connected with',con
auth=cl.auth(jid.getNode(),'password',resource=jid.getResource())
if not auth:
print 'could not authenticate!'
sys.exit()
print 'authenticated using',auth
cl.sendInitPresence()
time.sleep(1)
roster=xmpp.roster.Roster().getRoster()
print roster
cl.disconnect()
Jest to kod przykladu (przerobiony) z http://xmpppy.sourceforge.net/examples/xsend.py
Próbuję pobrać roster przez:
roster=xmpp.roster.Roster().getRoster()
ale dostaję błąd:
connected with tls
authenticated using sasl
Traceback (most recent call last):
File "./xsend.py", line 30, in <module>
roster=xmpp.roster.Roster().getRoster()
File "/usr/lib/python2.7/site-packages/xmpp/roster.py", line 60, in getRoster
if not self.set: self.Request()
File "/usr/lib/python2.7/site-packages/xmpp/roster.py", line 55, in Request
self._owner.send(Iq('get',NS_ROSTER))
AttributeError: Roster instance has no attribute '_owner'
Co robię źle ?