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 <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/ed2ce273 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/ed2ce273 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/ed2ce273 Branch: refs/heads/vmware-storage-motion Commit: ed2ce2737133de6277bba0be9b7e10d3faaf887d Parents: d8f5f2e Author: Prasanna Santhanam <[email protected]> Authored: Fri May 24 19:21:40 2013 +0530 Committer: Prasanna Santhanam <[email protected]> Committed: Fri May 24 19:22:49 2013 +0530 ---------------------------------------------------------------------- tools/marvin/marvin/cloudstackConnection.py | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ed2ce273/tools/marvin/marvin/cloudstackConnection.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/cloudstackConnection.py b/tools/marvin/marvin/cloudstackConnection.py index e3977dc..b092ef0 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
