In continuing working with XMPP and Python, I managed to get xmpppy working.
This proved to be particularly tricky because xmpppy uses some outdated modules like md5 and sha. It also relies on some dns functions which no longer seem to work.
I was able to use the sample script “xsend.py” that the project provides. The big thing is that I had to specify talk.google.com and the port number directly in the connect command.
If I did not specify the servername, I would get the error:
An error occurred while looking up _xmpp-client._tcp.example.com
NOTE: DNS is configured correctly for the domain I was practicing with, but the xmpppy code was not able to resolve it.
To run the script, simply execute;
./xblast.py [email protected] text to send
$Id: xsend.py,v 1.8 2006/10/06 12:30:42 normanr Exp $
if len(sys.argv) < 2:
print “Syntax: xsend JID text”
jidparams[‘password’] = ‘123456’
if not con:
print ‘could not connect!’
print ‘connected with’,con
if not auth:
print ‘could not authenticate!’
print ‘authenticated using’,auth
cl.SendInitPresence(requestRoster=0) # you may need to uncomment
this for old server
print ‘sent message with id’,id
time.sleep(1) # some older servers will not send the message if you disconnect immediately after sending