Python Send Code

From ThePlaz.com

Jump to: navigation, search
#!/usr/bin/python
import sys,os,xmpp 

msg="Hello World!"
jid="[email protected]" #had to register this account with the server
pwd="test" #don't know what the password is for the xos
 
#[email protected] plaz
#[email protected] kbaum
recipient="[email protected]"

jid=xmpp.protocol.JID(jid)
  
cl=xmpp.Client(jid.getDomain(),debug=[])
  
if cl.connect() == "":
         print "not connected"
         sys.exit(0)
 
if cl.auth(jid.getNode(),pwd) == None:
       print "authentication failed"
       sys.exit(0)
 
 
cl.send(xmpp.protocol.Message(recipient,msg))
 
cl.disconnect()