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 <tsp@apache.org>
This commit is contained in:
Prasanna Santhanam 2013-05-24 19:21:40 +05:30
parent d8f5f2ea10
commit ed2ce27371
1 changed files with 4 additions and 1 deletions

View File

@ -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