[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-bugs] #7328 [Stem]: Event Handling



#7328: Event Handling
-------------------------+--------------------------------------------------
 Reporter:  atagar       |          Owner:  atagar
     Type:  enhancement  |         Status:  new   
 Priority:  normal       |      Milestone:        
Component:  Stem         |        Version:        
 Keywords:               |         Parent:        
   Points:               |   Actualpoints:        
-------------------------+--------------------------------------------------
 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

-- 
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/7328>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs