Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

How To Send IM Jabber Message To Google Chat Using Python And Xmppy

DZone's Guide to

How To Send IM Jabber Message To Google Chat Using Python And Xmppy

·
Free Resource
// From http://www.franklinmint.fm/blog/archives/000603.html
// This works with version xmpppy-0.4.0.win32.exe from http://xmpppy.sourceforge.net/

import sys,xmpp

# Google Talk constants
FROM_GMAIL_ID = "user@gmail.com"
GMAIL_PASS = "password"
GTALK_SERVER = "talk.google.com"
TO_GMAIL_ID = "user@gmail.com"

jid=xmpp.protocol.JID(FROM_GMAIL_ID)
cl=xmpp.Client(jid.getDomain(),debug=[])
if not cl.connect((GTALK_SERVER,5222)):
    raise IOError('Can not connect to server.')
if not cl.auth(jid.getNode(),GMAIL_PASS):
    raise IOError('Can not auth with server.')

cl.send( xmpp.Message( "someone@gmail.com" ,"Hi" ) )
cl.disconnect()
Topics:

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}