How To Send IM Jabber Message To Google Chat Using Python And Xmppy
Join the DZone community and get the full member experience.
Join For Free// 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()
Python (language)
Google (verb)
Opinions expressed by DZone contributors are their own.
Trending
-
How To Scan and Validate Image Uploads in Java
-
WireMock: The Ridiculously Easy Way (For Spring Microservices)
-
Which Is Better for IoT: Azure RTOS or FreeRTOS?
-
Integration Testing Tutorial: A Comprehensive Guide With Examples And Best Practices
Comments