Skip to content

Instantly share code, notes, and snippets.

@phretor
Created September 30, 2011 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phretor/1253883 to your computer and use it in GitHub Desktop.
Save phretor/1253883 to your computer and use it in GitHub Desktop.
Wrapping Twisted
class Helper(object):
res = None
def search(self):
d = this_returns_a_deferred()
def _save(results):
self.res = results
d.addCallback(_save)
d.addBoth(lambda _: reactor.stop())
reactor.run()
return self.res
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment