Getting Google Talk working with PyXMPP

  • Post author:
  • Post category:Google

Jacek Konieczny has written the wholly fantabulous PyXMPP, which implements Jabber clients and servers in Python. Now, Google Talk is a Jabber server, but it needs TLS support before it works. The code is all there, but the echobot example in the download (look in the examples directory) doesn't show you how. It's not that hard though -- here's the patch I needed to make it work: --- echobot.py 2005-12-26 07:25:55.000000000 -0800 +++ echobot2.py 2006-10-25 04:25:02.000000000 -0700 @@ -13,6 +13,7 @@ from pyxmpp.all import JID,Iq,Presence,Message,StreamError from pyxmpp.jabber.client import JabberClient +from pyxmpp import streamtls class Client(JabberClient): """Simple bot (client) example. Uses `pyxmpp.jabber.client.JabberClient` @@ -28,8 +29,12 @@ # setup client with provided connection information # and identity data + + tls = streamtls.TLSSettings(require=True, verify_peer=False) + auth = ['sasl:PLAIN'] JabberClient.__init__(self, jid, password, - disco_name="PyXMPP example: echo bot", disco_type="bot") + disco_name="PyXMPP example: echo bot", disco_type="bot", + tls_settings=tls, auth_methods=auth) # register features to be announced via Service Discovery self.disco_info.add_feature("jabber:iq:version") That makes the __init__ method for the client: def __init__(self, jid, password): # if bare JID is provided add a resource -- it is required if not jid.resource: jid=JID(jid.node, jid.domain, "Echobot") # setup client with provided connection information # and identity data tls = streamtls.TLSSettings(require=True, verify_peer=False)…

Continue ReadingGetting Google Talk working with PyXMPP

A MythTV Jabber bot

  • Post author:
  • Post category:Mythtv

While I love my wife and kids to distraction, the distraction bit is real. Then again, I'm sure they have a counter argument that I tend to end up deep in thought, and which point you could probably push me off my chair and I wouldn't notice. Anyway, that's mostly beside the point. What is relevant is for the first time in nearly a year (since 18 November 2005 to be exact, but who is counting?) I'm alone. All alone. So, apart from watching the West Wing (which I haven't seen before, and is fantastic), sleeping in, and going to a party tonight, I am coding. What I'm writing is a follow on from my night hacking the other day, which was getting PyXMPP working with Google Talk. What I want is a bot which will take IM messages, and execute them using the MythTV front end. Oh, and it will display text using the on screen display if you ask nicely. So, does anyone have any thoughts on if that sort of thing is useful to them? I think it sounds useful to me, but perhaps I'm odd. Back to hacking.

Continue ReadingA MythTV Jabber bot

End of content

No more pages to load