I'm trying to create a very simple script that uses python's xmpppy to send a message over facebook chat.
import xmpp FACEBOOK_ID = "username@chat.facebook.com" PASS = "password" SERVER = "chat.facebook.com" jid=xmpp.protocol.JID(FACEBOOK_ID) C=xmpp.Client(jid.getDomain(),debug=[]) if not C.connect((SERVER,5222)): raise IOError('Can not connect to server.') if not C.auth(jid.getNode(),PASS): raise IOError('Can not auth with server.') C.send(xmpp.protocol.Message("friend@chat.facebook.com","Hello world",))
This code works to send a message via gchat, however when I try with facebook I recieve this error:
An error occurred while looking up _xmpp-client._tcp.chat.facebook.com
When I remove @chat.facebook.com from the FACEBOOK_ID I get this instead:
File "gtalktest.py", line 11, in if not C.connect((SERVER,5222)): File "/home/john/xmpppy-0.3.1/xmpp/client.py", line 195, in connect if not CommonClient.connect(self,server,proxy,secure,use_srv) or secureNone and not secure: return self.connected File "/home/john/xmpppy-0.3.1/xmpp/client.py", line 179, in connect if not self.Process(1): return File "/home/john/xmpppy-0.3.1/xmpp/dispatcher.py", line 302, in dispatch handler['func'](session,stanza) File "/home/john/xmpppy-0.3.1/xmpp/dispatcher.py", line 214, in streamErrorHandler raise exc((name,text)) xmpp.protocol.HostUnknown: (u'host-unknown', '')
I also notice any time I import xmpp I get the following two messages when running:
/home/john/xmpppy-0.3.1/xmpp/auth.py:24: DeprecationWarning: the sha module is deprecated; use the hashlib module instead import sha,base64,random,dispatcher /home/john/xmpppy-0.3.1/xmpp/auth.py:26: DeprecationWarning: the md5 module is deprecated; use hashlib instead import md5
I'm fairly new to solving these kinds of problems, and advise, or links to resources that could help me move forward in solve these issues would be greatly appreciated. Thanks for reading!