t.i.t.react(main, argv=(), _reactor=None) : function documentation

Part of twisted.internet.task View Source

Call main and run the reactor until the Deferred it returns fires.

This is intended as the way to start up an application with a well-defined completion condition. Use it to write clients or one-off asynchronous operations. Prefer this to calling reactor.run directly, as this function will also:

The following demonstrates the signature of a main function which can be used with react:

     def main(reactor, username, password):
         return defer.succeed('ok')

     task.react(main, ('alice', 'secret'))
ParametersmainA callable which returns a Deferred. It should take the reactor as its first parameter, followed by the elements of argv.
argvA list of arguments to pass to main. If omitted the callable will be invoked with no additional arguments.
_reactorAn implementation detail to allow easier unit testing. Do not supply this parameter.
Present Since12.3
API Documentation for Twisted, generated by pydoctor at 2015-01-30 14:14:53.