2

I am trying to write a script in python to connect to facebook chat. I am just not able to. Here is the code

import xmpp
FACEBOOK_ID = "username1@chat.facebook.com"
PASS = "password"

jid=xmpp.protocol.JID(FACEBOOK_ID)

C=xmpp.Client(jid.getDomain(),debug=[])

if not C.connect(("chat.facebook.com",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("username2@chat.facebook.com","Hello world from script",))

And this is the error

An error occurred while looking up _xmpp-client._tcp.chat.facebook.com

A similar question has been asked before but None of the answers have helped me and I can't find any answer online that has solved this for me. Any help would be really appreciated coz I am really stuck at this for days now.

Thanks a lot for your help.

Community
  • 1
  • 1
firesofmay
  • 582
  • 1
  • 3
  • 16

0 Answers0