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

[tor-commits] [fallback-scripts/master] generate: Handle new exceptions added by stem



commit 22ac1c66a920cb0b6b4181df4a32a3e842ecb250
Author: teor <teor@xxxxxxxxxxxxxx>
Date:   Mon Dec 2 13:56:09 2019 +1000

    generate: Handle new exceptions added by stem
    
    But maintain compatibility with older stem versions.
    
    Part of 28863.
---
 generateFallbackDirLine.py | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/generateFallbackDirLine.py b/generateFallbackDirLine.py
index b856c93..2177e00 100755
--- a/generateFallbackDirLine.py
+++ b/generateFallbackDirLine.py
@@ -9,9 +9,18 @@
 import sys
 import urllib2
 
+import stem
 import stem.descriptor.remote
 import stem.util.tor_tools
 
+## Stem version compatibility
+try:
+  stem_DownloadFailed = stem.DownloadFailed
+except AttributeError:
+  class DummyException(BaseException):
+    pass
+  stem_DownloadFailed = DummyException
+
 if len(sys.argv) <= 1:
   print('Usage: %s fingerprint ...' % sys.argv[0])
   sys.exit(1)
@@ -29,6 +38,9 @@ for fingerprint in sys.argv[1:]:
       continue
     else:
       raise
+  except stem_DownloadFailed as exc:
+    print('# %s not found by stem' % fingerprint)
+    continue
 
   if not desc.dir_port:
     print("# %s needs a DirPort" % fingerprint)



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits