Created
March 14, 2013 06:28
-
-
Save s3thi/5159269 to your computer and use it in GitHub Desktop.
Small Facebook chat example using xmpppy.
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, 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