Hi Frederick:
>I'm looking for a non-blocking XML-RPC library for stackless.
>Is it out there ?
If you are willing to learn a little about what is happening under the
hood, you could use Twisted, in this case, its XML-RPC class.
Here is a simple example modified from the Twisted XML-RPC page:
import stackless
from twisted.web.xmlrpc import Proxy
from twisted.internet import reactor
def blockOn(deferred):
channel = stackless.channel()
def success(answer):
channel.send((True,answer))
def failure(problem):
channel.send((False,problem))
deferred.addCallbacks(success, failure)
return channel.receive()
def client():
proxy = Proxy('http://advogato.org/XMLRPC')
value = blockOn(proxy.callRemote('test.sumprod', 3, 5))
print value
stackless.tasklet(client)()
stackless.tasklet(reactor.run)()
stackless.run()
With Twisted, as most reactor based systems, you have to associated a callback
with a channel. Here, I happen to use Christopher Armstrong's blockOn()
technique. I have found blockOn() suffices for many simple (and not so simple)
tasks. There is a little more to it, but not that much more.
Cheers,
Andrew
_______________________________________________
Stackless mailing list
[email protected]
http://www.stackless.com/mailman/listinfo/stackless