How to send IM jabber message to google chat using python and xmppy
// This works with version xmpppy-0.4.0.win32.exe from http://xmpppy.sourceforge.net/
1 2 import sys,xmpp 3 4 # Google Talk constants 5 FROM_GMAIL_ID = "user@gmail.com" 6 GMAIL_PASS = "password" 7 GTALK_SERVER = "talk.google.com" 8 TO_GMAIL_ID = "user@gmail.com" 9 10 jid=xmpp.protocol.JID(FROM_GMAIL_ID) 11 cl=xmpp.Client(jid.getDomain(),debug=[]) 12 if not cl.connect((GTALK_SERVER,5222)): 13 raise IOError('Can not connect to server.') 14 if not cl.auth(jid.getNode(),GMAIL_PASS): 15 raise IOError('Can not auth with server.') 16 17 cl.send( xmpp.Message( "someone@gmail.com" ,"Hi" ) ) 18 cl.disconnect()