I found a python module xmpp which looked like it should do the trick, and got it working as follows...
Installed the python xmpp egg by doing:
- sudo python ./ez_setup.py
- sudo easy_install xmpppy
Tried the code in the article and comments here: http://www.larsen-b.com/Article/214.html but kept getting authentication errors.
Failed SASL authentification:
This article led me to try turning off SASL with the following line:
client.auth(user='myuser', password='password', sasl=0)
Which dumped some more helpful errors, and eventually made me realise that (for my gmail address) the domain expected in the xmpp.Client is not 'gmail.com' but 'googlemail.com'
I fixed up the paraemters passed to the xmpp.Client constructor, and the following code worked:
import xmpp
client = xmpp.Client('googlemail.com')
client.connect(server=('talk.google.com',5222))
client.auth(user='myuser', password='password')
client.send( xmpp.Message('markrp@gmail.com', 'Hello World'))
No comments:
Post a Comment