[stem/master] Accounting for unattached streams in the exit_used example

commit f46974987106e3246482158e009491faa07bbae4 Author: Damian Johnson <atagar@torproject.org> Date: Wed Jun 4 08:58:38 2014 -0700 Accounting for unattached streams in the exit_used example Issue mentioned on... https://stem.torproject.org/tutorials/examples/exit_used.html --- docs/tutorials/examples/exit_used.rst | 2 +- stem/response/events.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/tutorials/examples/exit_used.rst b/docs/tutorials/examples/exit_used.rst index a4011f1..26a9a63 100644 --- a/docs/tutorials/examples/exit_used.rst +++ b/docs/tutorials/examples/exit_used.rst @@ -32,7 +32,7 @@ the requests going through Tor... def stream_event(controller, event): - if event.status == StreamStatus.SUCCEEDED: + if event.status == StreamStatus.SUCCEEDED and event.circ_id: circ = controller.get_circuit(event.circ_id) exit_fingerprint = circ.path[-1][0] diff --git a/stem/response/events.py b/stem/response/events.py index 773769f..582eb22 100644 --- a/stem/response/events.py +++ b/stem/response/events.py @@ -876,7 +876,8 @@ class StreamEvent(Event): :var str id: stream identifier :var stem.StreamStatus status: reported status for the stream - :var str circ_id: circuit that the stream is attached to + :var str circ_id: circuit that the stream is attached to, this is **None** of + the stream is unattached :var str target: destination of the stream :var str target_address: destination address (ip, hostname, or '(Tor_internal)') :var int target_port: destination port
participants (1)
-
atagar@torproject.org