Updated Branches: refs/heads/requestsformarvin 20ce63fcf -> 5ef3c446e
get the api signing to work Signed-off-by: Prasanna Santhanam <t...@apache.org> Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/5ef3c446 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/5ef3c446 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/5ef3c446 Branch: refs/heads/requestsformarvin Commit: 5ef3c446e3029db19fa083b2545b5bfb5ae26efb Parents: 20ce63f Author: Prasanna Santhanam <t...@apache.org> Authored: Wed Apr 17 19:04:41 2013 +0530 Committer: Prasanna Santhanam <t...@apache.org> Committed: Wed Apr 17 19:04:41 2013 +0530 ---------------------------------------------------------------------- tools/marvin/marvin/cloudstackConnection.py | 9 ++++----- 1 files changed, 4 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5ef3c446/tools/marvin/marvin/cloudstackConnection.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/cloudstackConnection.py b/tools/marvin/marvin/cloudstackConnection.py index 06c846c..5fd3e12 100644 --- a/tools/marvin/marvin/cloudstackConnection.py +++ b/tools/marvin/marvin/cloudstackConnection.py @@ -65,7 +65,7 @@ class cloudConnection(object): timeout = self.asyncTimeout while timeout > 0: - asyncResonse = self.marvin_request(cmd, response, True) + asyncResonse = self.marvin_request(cmd, response_type=response) if asyncResonse.jobstatus == 2: raise cloudstackException.cloudstackAPIException("asyncquery", asyncResonse.jobresult) @@ -86,16 +86,15 @@ class cloudConnection(object): @param payload: dict of GET params to be signed @return: the signature of the payload """ - params = zip(payload.keys(), map(lambda v: urllib.quote_plus(v), payload.values())) + params = zip(payload.keys(), payload.values()) params.sort(key=lambda k: str.lower(k[0])) hashStr = "&".join( ["=".join( [str.lower(r[0]), str.lower(urllib.quote_plus(str(r[1]))).replace("+", "%20")] ) for r in params] ) - signature = urllib.quote_plus( - base64.encodestring(hmac.new(self.securityKey, hashStr, hashlib.sha1).digest()).strip() - ) + signature = base64.encodestring(hmac.new(self.securityKey, hashStr, hashlib.sha1).digest()).strip() + self.logging.info("Computed Signature by Marvin: %s"%signature) return signature def request(self, command, auth=True, payload={}, data={}):