Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • Trac Trac
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Issues 246
    • Issues 246
    • List
    • Boards
    • Service Desk
    • Milestones
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value stream
  • Wiki
    • Wiki
  • Activity
  • Create a new issue
  • Issue Boards
Collapse sidebar
  • Legacy
  • TracTrac
  • Issues
  • #7328

Closed
Open
Created Nov 05, 2012 by Damian Johnson@atagar

Event Handling

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

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking