[tor-commits] [stem/master] Adding a get_vote() method to the DescriptorDownloader
atagar at torproject.org
atagar at torproject.org
Sun Sep 22 00:59:29 UTC 2013
commit f40c912ecb8fdb542a7bd12e7a440e5301ea9798
Author: Damian Johnson <atagar at torproject.org>
Date: Sat Sep 21 17:41:13 2013 -0700
Adding a get_vote() method to the DescriptorDownloader
Stem is frequently being used for answering questions concerning directory
authorities, so adding a method to more intuitively get their votes.
---
stem/descriptor/remote.py | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/stem/descriptor/remote.py b/stem/descriptor/remote.py
index 6b4a6da..4b04767 100644
--- a/stem/descriptor/remote.py
+++ b/stem/descriptor/remote.py
@@ -534,6 +534,25 @@ class DescriptorDownloader(object):
return self.query(resource + '.z', **query_args)
+ def get_vote(self, authority, **query_args):
+ """
+ Provides the present vote for a given directory authority.
+
+ :param stem.descriptor.remote.DirectoryAuthority authority: authority for which to retrieve a vote for
+ :param query_args: additional arguments for the
+ :class:`~stem.descriptor.remote.Query` constructor
+
+ :returns: :class:`~stem.descriptor.remote.Query` for the router status
+ entries
+ """
+
+ resource = '/tor/status-vote/current/authority'
+
+ if not 'endpoint' in query_args:
+ query_args['endpoints'] = [(authority.address, authority.dir_port)]
+
+ return self.query(resource + '.z', **query_args)
+
def get_key_certificates(self, authority_v3idents = None, **query_args):
"""
Provides the key certificates for authorities with the given fingerprints.
More information about the tor-commits
mailing list