From 1e9b0e85a5de03f399c0cf52f46458dc6e77e103 Mon Sep 17 00:00:00 2001 From: drebs Date: Tue, 30 Apr 2013 17:25:43 -0300 Subject: Add docstrings to auth methods. --- src/leap/soledad/auth.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/leap') diff --git a/src/leap/soledad/auth.py b/src/leap/soledad/auth.py index 35f4700f..094278dc 100644 --- a/src/leap/soledad/auth.py +++ b/src/leap/soledad/auth.py @@ -18,6 +18,9 @@ """ Methods for token-based authentication. + +These methods have to be included in all classes that extend HTTPClient so +they can do token-based auth requests to the Soledad server. """ @@ -25,10 +28,28 @@ from u1db.remote.http_client import HTTPClientBase def set_token_credentials(self, address, token): + """ + Store given credentials so we can sign the request later. + + @param address: The user's address. + @type address: str + @param token: The authentication token. + @type token: str + """ self._creds = {'token': (address, token)} def _sign_request(self, method, url_query, params): + """ + Return an authorization header to be included in the HTTP request. + + @param method: The HTTP method. + @type method: str + @param url_query: The URL query string. + @type url_query: str + @param params: A list with encoded query parameters. + @type param: list + """ if 'token' in self._creds: address, token = self._creds['token'] auth = '%s:%s' % (address, token) -- cgit v1.2.3