[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [stem/master] Added convenient methods in BaseController and Controller.
commit c4b5917be15fdfce5921b2dd704f025be59ae97d
Author: Beck <csybeck@xxxxxxxxx>
Date: Thu Jun 7 10:45:57 2012 +0800
Added convenient methods in BaseController and Controller.
---
stem/control.py | 26 ++++++++++++--------------
1 files changed, 12 insertions(+), 14 deletions(-)
diff --git a/stem/control.py b/stem/control.py
index 25b7b68..9ceb630 100644
--- a/stem/control.py
+++ b/stem/control.py
@@ -200,8 +200,6 @@ class BaseController:
"""
return self._socket
-
-
def add_status_listener(self, callback, spawn = True):
"""
@@ -481,46 +479,46 @@ class Controller(BaseController):
except stem.socket.ControllerError, exc:
if default == UNDEFINED: raise exc
else: return default
-
+
def get_version(self):
"""
A convenience method to get tor version that current controller is
connected to.
-
+
:returns: :class:`stem.version.Version`
-
+
:raises:
* :class:`stem.socket.ControllerError` if unable to query the version
* ValueError if unable to parse the version
"""
-
+
import stem.version
raw_str = self.get_info("version")
version_str = raw_str[:raw_str.find(' ')]
return stem.version.Version(version_str)
-
+
def authenticate(self, *args, **kwargs):
"""
A convenience method to authenticate the controller.
-
+
:param: see :func:`stem.connection.authenticate`
-
+
:raises: see :func:`stem.connection.authenticate`
"""
-
+
import stem.connection
stem.connection.authenticate(self, *args, **kwargs)
-
+
def protocolinfo(self):
"""
A convenience method to get the protocol info of the controller.
-
+
:returns: :class:`stem.response.protocolinfo.ProtocolInfoResponse` provided by tor
-
+
:raises:
* :class:`stem.socket.ProtocolError` if the PROTOCOLINFO response is malformed
* :class:`stem.socket.SocketError` if problems arise in establishing or using the socket
"""
-
+
import stem.connection
return stem.connection.get_protocolinfo(self)
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits