Difference between revisions of "Python Send Code"

From ThePlaz.com

Jump to: navigation, search
(post code)
 
 
Line 1: Line 1:
<nowiki>
+
<pre>
 
#!/usr/bin/python
 
#!/usr/bin/python
 
import sys,os,xmpp  
 
import sys,os,xmpp  
Line 27: Line 27:
 
   
 
   
 
cl.disconnect()
 
cl.disconnect()
</nowiki>
+
</pre>

Latest revision as of 20:07, 9 December 2009

#!/usr/bin/python
import sys,os,xmpp 

msg="Hello World!"
jid="mac@jabber.laptop.org" #had to register this account with the server
pwd="test" #don't know what the password is for the xos
 
#c9dcdd473a2817adf24ff26430f657c981857134@jabber.laptop.org plaz
#182f647d0a622b2fbc0a7bfbb35aba6f927b1b53@jabber.laptop.org kbaum
recipient="c9dcdd473a2817adf24ff26430f657c981857134@jabber.laptop.org"

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()