Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
import txtorcon
from twisted.internet import defer, task
async def main(reactor):
tor = await txtorcon.connect(reactor)
print("tor {}".format(tor))
state = await tor.create_state()
print("state {}".format(state))
print("waiting for new stream events:")
async for name, args, kw in state.stream_events('new'):
stream = args[0]
print("{}: {}".format(name, stream))
def _main(reactor):
d = defer.ensureDeferred(main(reactor))
return d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment