Getting jabber:iq:last with xmpppy

G

georgeencina

Hi,
I'm trying to do the following with the xmpppy library:
- log on to the google jabber server
- get idle time of one specific person on my roster.

Idle time means the values of jabber:iq:last.

When I do this in pidgin with the xmpp console open, I get the
following conversation:

(me)
<iq type='get' id='purpleb22cf798' to='(e-mail address removed)/
Gaim2AD95550'>
<query xmlns='jabber:iq:last'/>
</iq>

(other person)
<iq type='result' id='purpleb22cf798' to='(e-mail address removed)/
GaimA9B7F02F' from='(e-mail address removed)/Gaim2AD95550'>
<query xmlns='jabber:iq:last' seconds='126517'/>
</iq>

Now, I'd like to do the same in python.
I'm logged in to the server with the following code.

import xmpp
login = 'georgeencina' # @gmail.com
pwd = 'secret'
cnx = xmpp.Client('gmail.com')
cnx.connect( server=('talk.google.com',5223) )
cnx.auth(login,pwd, 'idlewatcher')

What would be the next step? I saw there is an xmpp.Iq class, which I
suppose is what I need to work with to construct the message I
observed in Pidgin.

Does anyone have some quick lines of code on how to construct and send
the message, and how to receive the response?

Thanks,
George
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,038
Latest member
OrderProperKetocapsules

Latest Threads

Top