From ed2ce2737133de6277bba0be9b7e10d3faaf887d Mon Sep 17 00:00:00 2001 From: Prasanna Santhanam Date: Fri, 24 May 2013 19:21:40 +0530 Subject: [PATCH] CLOUDSTACK-2652: requests module differs on Python 2.6 On 2.6 response.json returns the JSOn in the response while on 2.7 response.json() is a method. Since Marvin installs on both platforms fixing the error appropriately Signed-off-by: Prasanna Santhanam --- tools/marvin/marvin/cloudstackConnection.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/marvin/marvin/cloudstackConnection.py b/tools/marvin/marvin/cloudstackConnection.py index e3977dcf7d4..b092ef0c32f 100644 --- a/tools/marvin/marvin/cloudstackConnection.py +++ b/tools/marvin/marvin/cloudstackConnection.py @@ -219,7 +219,10 @@ class cloudConnection(object): cmdname, self.auth, payload=payload, method=method) self.logging.debug("Request: %s Response: %s" % (response.url, response.text)) - response = jsonHelper.getResultObj(response.json(), response_type) + try: + response = jsonHelper.getResultObj(response.json(), response_type) + except TypeError: + response = jsonHelper.getResultObj(response.json, response_type) if isAsync == "false": return response