fettig.net

Google

Posted by Abe on Tuesday, October 1, 2002 @ 11:39 am

Earlier this morning I did a google search on “twisted python jabber“. Looking through the results I was surprised to see my very own site in the first page of results. I’d never had something like that happen before, and I wasn’t sure what to think of it.

My first reaction was, “Wow, Google noticed what I’ve been doing!”. After all, I just posted my first comments on Twisted a few days ago. But then I realized that seeing my site so high in the results only meant that I wasn’t going to find anybody who knows more about using Jabber with Twisted than I do. And I don’t know very much.

So I guess I’m on my own on this one. At least if I figure something out and post it here other people will be able to find it.

Asynchronous XML-RPC

Posted by Abe on Tuesday, October 1, 2002 @ 11:20 am

As part of converting Hep to use the Twisted Framework, I had to find a way to do XML-RPC calls asynchronously. This is to avoid having Hep freeze up while waiting to for an XML-RPC reply to come back from a server.

The result was asyncxmlrpc.py, which you can find here. It provides a ServerProxy class that works just like the one in Python’s built-in xmlrpclib, except that when you call a function it returns a Twisted Deferred object that you can add callbacks too.

Example:


from twisted.internet import reactor

def printState(stateName):

    print stateName

import asyncxmlrpc

s = asyncxmlrpc.ServerProxy('http://betty.userland.com')

d = s.examples.getStateName(19)

d.addCallback(printState)

reactor.run()

At the moment this only works over straight HTTP, no SSL. And of course, it requires Twisted to work.

« Previous Page