commit 221a3499c76b71a38d0f79f9f64cabebd66e4992
Author: Damian Johnson <atagar(a)torproject.org>
Date: Fri Sep 7 04:03:25 2018 -0700
Missing ORPort descriptor download example
Oops, forgot to add the new example when expanding our tutorial in the last
commit.
---
docs/_static/example/descriptor_from_orport.py | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/docs/_static/example/descriptor_from_orport.py b/docs/_static/example/descriptor_from_orport.py
new file mode 100644
index 00000000..48b0673b
--- /dev/null
+++ b/docs/_static/example/descriptor_from_orport.py
@@ -0,0 +1,14 @@
+import stem.descriptor.remote
+
+# Unlike the above example, this one downloads specifically through the
+# ORPort of moria1 (long time tor directory authority).
+
+try:
+ consensus = stem.descriptor.remote.get_consensus(
+ endpoints = (stem.ORPort('128.31.0.34', 9101),)
+ )
+
+ for desc in consensus:
+ print("found relay %s (%s)" % (desc.nickname, desc.fingerprint))
+except Exception as exc:
+ print("Unable to retrieve the consensus: %s" % exc)