[tor-commits] [stem/master] Stub for a remote descriptor fetching module
atagar at torproject.org
atagar at torproject.org
Mon Jul 22 03:10:17 UTC 2013
commit 65924aff93ef70c879175510e9cd2307e8507a9e
Author: Damian Johnson <atagar at torproject.org>
Date: Thu Jun 20 08:57:36 2013 -0700
Stub for a remote descriptor fetching module
Starting a module for remote descriptor fetching. Presently this just includes
a no-op DescriptorDownloader class. Guts of this sucker are coming soon!
---
stem/descriptor/__init__.py | 1 +
stem/descriptor/remote.py | 26 ++++++++++++++++++++++++++
test/settings.cfg | 2 +-
3 files changed, 28 insertions(+), 1 deletion(-)
diff --git a/stem/descriptor/__init__.py b/stem/descriptor/__init__.py
index 7252e6a..dc982f4 100644
--- a/stem/descriptor/__init__.py
+++ b/stem/descriptor/__init__.py
@@ -40,6 +40,7 @@ Package for parsing and processing descriptor data.
__all__ = [
"export",
"reader",
+ "remote",
"extrainfo_descriptor",
"server_descriptor",
"microdescriptor",
diff --git a/stem/descriptor/remote.py b/stem/descriptor/remote.py
new file mode 100644
index 0000000..ea8dbb3
--- /dev/null
+++ b/stem/descriptor/remote.py
@@ -0,0 +1,26 @@
+# Copyright 2013, Damian Johnson
+# See LICENSE for licensing information
+
+"""
+Utilities for retrieving descriptors from directory authorities and mirrors.
+This is mostly done through the
+:class:`~stem.descriptor.remote.DescriptorDownloader` class, which issues the
+requests and provides back parsed content. For example...
+
+::
+
+ downloader = DescriptorDownloader(
+ cache = '/tmp/descriptor_cache',
+ use_mirrors = True,
+ )
+
+ try:
+ for desc in downloader.get_server_descriptors():
+ if desc.exit_policy.is_exiting_allowed():
+ print "%s (%s)" % (desc.nickname, desc.fingerprint)
+ except IOError, exc:
+ print "Unable to query the server descriptors: %s" % exc
+"""
+
+class DescriptorDownloader(object):
+ pass
diff --git a/test/settings.cfg b/test/settings.cfg
index 16d8c8b..d5c0997 100644
--- a/test/settings.cfg
+++ b/test/settings.cfg
@@ -134,7 +134,7 @@ pyflakes.ignore stem/prereq.py => 'RSA' imported but unused
pyflakes.ignore stem/prereq.py => 'asn1' imported but unused
pyflakes.ignore stem/prereq.py => 'mock' imported but unused
pyflakes.ignore stem/prereq.py => 'long_to_bytes' imported but unused
-pyflakes.ignore stem/descriptor/__init__.py => redefinition of unused 'OrderedDict' from line 61
+pyflakes.ignore stem/descriptor/__init__.py => redefinition of unused 'OrderedDict' from line 62
pyflakes.ignore stem/util/str_tools.py => redefinition of function '_to_bytes_impl' from line 51
pyflakes.ignore stem/util/str_tools.py => redefinition of function '_to_unicode_impl' from line 57
pyflakes.ignore test/mocking.py => undefined name 'builtins'
More information about the tor-commits
mailing list