Created
April 7, 2017 21:20
-
-
Save meejah/0d1dccb978b0098b8e09a002f7ffdd2f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) | |
@task.react | |
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