[tor-commits] [stem/master] Remove DescriptorReader from collector example

atagar at torproject.org atagar at torproject.org
Sat Aug 17 20:44:27 UTC 2019


commit 3996b3260aa702b9303bdba7c813fb30b5f932c5
Author: Damian Johnson <atagar at torproject.org>
Date:   Sun Jun 23 13:28:37 2019 -0700

    Remove DescriptorReader from collector example
    
    We're deprecating DescriptorReader, so best not to use it to exemplify usage of
    this new module.
---
 stem/descriptor/collector.py | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/stem/descriptor/collector.py b/stem/descriptor/collector.py
index bf98dc78..4ccf9395 100644
--- a/stem/descriptor/collector.py
+++ b/stem/descriptor/collector.py
@@ -30,8 +30,8 @@ With this you can either download and read directly from CollecTor...
 ::
 
   import datetime
+  import stem.descriptor
   import stem.descriptor.collector
-  import stem.descriptor.reader
 
   collector = stem.descriptor.collector.CollecTor()
   yesterday = datetime.date.today() - datetime.timedelta(1)
@@ -41,9 +41,7 @@ With this you can either download and read directly from CollecTor...
     start = yesterday,
   ).join()
 
-  reader = stem.descriptor.reader.DescriptorReader('~/descriptor_cache')
-
-  for desc in reader:
+  for desc in stem.descriptor.parse_file('~/descriptor_cache', descriptor_type = 'server-descriptor 1.0'):
     if desc.exit_policy.is_exiting_allowed():
       print('  %s (%s)' % (desc.nickname, desc.fingerprint))
 





More information about the tor-commits mailing list