Created
February 8, 2012 16:46
-
-
Save nixmaniack/1770976 to your computer and use it in GitHub Desktop.
GTalk XMPP Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import xmpp | |
GMAIL_ID = '[email protected]' | |
PASS = 'yourpass' # if you have app specific pass, you'll need to generate one for this | |
jid = xmpp.protocol.JID(GMAIL_ID) | |
C = xmpp.Client(jid.getDomain(), debug=['always']) | |
if not C.connect(("talk.google.com",5223)): | |
raise IOError('Can not connect') | |
if not C.auth(jid.getNode(),PASS): | |
raise IOError('Can not auth with server') | |
# use following to get list of contacts | |
C.sendInitPresence(requestRoster=1) | |
#rosterobject = C.getRoster() | |
# I used the following loop just to check my contacts, it's not need if you know the ID | |
#for i in rosterobject.getItems(): | |
# print i | |
C.send( xmpp.Message('[email protected]', "hello") ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment