[tor-commits] [stem/master] Skip internal circuits in exit_used.py example
atagar at torproject.org
atagar at torproject.org
Thu Nov 18 22:02:33 UTC 2021
commit 57364fae7269ec562c5fc8cdb073ff9463d9a0f0
Author: Damian Johnson <atagar at torproject.org>
Date: Thu Nov 18 14:00:32 2021 -0800
Skip internal circuits in exit_used.py example
pragma31 made the good point that exit_used.py confusingly presents the
internal 1-hop circuits for fetching descriptors. Filtering those out.
https://github.com/torproject/stem/pull/111
---
docs/_static/example/exit_used.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/docs/_static/example/exit_used.py b/docs/_static/example/exit_used.py
index 4462620e..405425e4 100644
--- a/docs/_static/example/exit_used.py
+++ b/docs/_static/example/exit_used.py
@@ -1,6 +1,6 @@
import functools
-from stem import StreamStatus
+from stem import CircBuildFlag, StreamStatus
from stem.control import EventType, Controller
@@ -21,6 +21,9 @@ async def stream_event(controller, event):
if event.status == StreamStatus.SUCCEEDED and event.circ_id:
circ = await controller.get_circuit(event.circ_id)
+ if CircBuildFlag.IS_INTERNAL in circ.build_flags:
+ return
+
exit_fingerprint = circ.path[-1][0]
exit_relay = await controller.get_network_status(exit_fingerprint)
More information about the tor-commits
mailing list