Skip to content
Snippets Groups Projects
Closed Event Handling
  • View options
  • Event Handling

  • View options
  • Closed Issue created by Damian Johnson

    Hi Ravi. Pushed a start for tor event handling to the 'events' branch of my repository...

    https://gitweb.torproject.org/user/atagar/stem.git/shortlog/refs/heads/events

    Usage is pretty simple. The following for instance would print the bytes sent and received by tor for five seconds...

    import time
    from stem.control import Controller, EventType
    
    def print_bw(event):
      print "sent: %i, received: %i" % (event.written, event.read)
    
    with Controller.from_port(control_port = 9051) as controller:
      controller.authenticate()
      controller.add_event_listener(print_bw, EventType.BW)
      time.sleep(5)

    Cheers! -Damian

    Linked items ... 0

  • Activity

    • All activity
    • Comments only
    • History only
    • Newest first
    • Oldest first
    Loading Loading Loading Loading Loading Loading Loading Loading Loading Loading