Skip to content

Instantly share code, notes, and snippets.

@s3thi
Created March 14, 2013 06:28
Show Gist options
  • Save s3thi/5159269 to your computer and use it in GitHub Desktop.
Save s3thi/5159269 to your computer and use it in GitHub Desktop.
Small Facebook chat example using xmpppy.
import xmpp, time
FB_ID = '[email protected]'
PASS = 'password'
jid = xmpp.protocol.JID(FB_ID)
client = xmpp.Client(jid.getDomain(), debug=[])
if not client.connect(('chat.facebook.com', 5222)):
raise IOError('could not connect to Facebook')
if not client.auth(jid.getNode(), PASS):
raise IOError('could not authenticate')
def message_handler(connection, msg_node):
print(msg_node)
client.RegisterHandler('message', message_handler)
time.sleep(60)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment