[tor-commits] [stem/master] Exemplify collector functions rather than methods
atagar at torproject.org
atagar at torproject.org
Sat Aug 17 20:44:27 UTC 2019
commit 7033ab1327f5a12c75558b531222d0048b410c71
Author: Damian Johnson <atagar at torproject.org>
Date: Sun Jun 23 13:31:43 2019 -0700
Exemplify collector functions rather than methods
Like stem.descriptor.remote I plan to add function counterparts of our
CollecTor class methods. If users don't need to customize their instance (which
will be the case for almost all users) the functions will be more convenient
than a class.
---
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 4ccf9395..7a3d04ff 100644
--- a/stem/descriptor/collector.py
+++ b/stem/descriptor/collector.py
@@ -16,12 +16,11 @@ With this you can either download and read directly from CollecTor...
import datetime
import stem.descriptor.collector
- collector = stem.descriptor.collector.CollecTor()
yesterday = datetime.date.today() - datetime.timedelta(1)
# provide yesterday's exits
- for desc in collector.get_server_descriptors(start = yesterday):
+ for desc in stem.descriptor.collector.get_server_descriptors(start = yesterday):
if desc.exit_policy.is_exiting_allowed():
print(' %s (%s)' % (desc.nickname, desc.fingerprint))
@@ -33,10 +32,9 @@ With this you can either download and read directly from CollecTor...
import stem.descriptor
import stem.descriptor.collector
- collector = stem.descriptor.collector.CollecTor()
yesterday = datetime.date.today() - datetime.timedelta(1)
- collector.download_server_descriptors(
+ stem.descriptor.collector.download_server_descriptors(
destination = '~/descriptor_cache',
start = yesterday,
).join()
More information about the tor-commits
mailing list