[Twisted-Python] Waiting on a Deferred

Jean-Paul Calderone exarkun at divmod.com
Tue Jul 22 14:25:04 EDT 2008


On Tue, 22 Jul 2008 11:17:07 -0700, Saketh <saketh.bhamidipati at gmail.com> wrote:
>Hello everyone,
>
>Is it possible to call asynchronous methods synchronously?
>
>I'm asking because I have an xmlrpc.XMLRPC server which distributes a
>calculation across several remote servers, collects the results in a
>DeferredList, and wraps it all inside an xmlrpc_something method. Thus, it
>needs to return the result to a web browser synchronously.

You don't need to "call asynchronous methods synchronously" to do this.
twisted.web.xmlrpc.XMLRPC.xmlrpc_* methods can return Deferreds.  If they
do, the response to the browser is delayed until the result of the Deferred
is available.

Jean-Paul




More information about the Twisted-Python mailing list