Modify to support Python 3.0

Update the code to change issue found by running 2to3 utility.
This commit is contained in:
Kurt Martin 2014-01-07 13:27:12 -08:00
parent 86e1c3178a
commit 52b5f42828
3 changed files with 8 additions and 8 deletions

View File

@ -24,11 +24,11 @@ HP LeftHand REST Client
"""
version_tuple = (1, 0, 0)
version_tuple = (1, 0, 1)
def get_version_string():
if isinstance(version_tuple[-1], basestring):
if isinstance(version_tuple[-1], str):
return '.'.join(map(str, version_tuple[:-1])) + version_tuple[-1]
return '.'.join(map(str, version_tuple))

View File

@ -74,7 +74,6 @@ class HTTPJSONRESTClient(httplib2.Http):
def set_url(self, api_url):
#should be http://<Server:Port>/lhos
self.api_url = api_url.rstrip('/')
self.api_url = self.api_url
def set_debug_flag(self, flag):
"""
@ -211,7 +210,7 @@ class HTTPJSONRESTClient(httplib2.Http):
return resp, body
def _do_reauth(self, url, method, ex, **kwargs):
print "_do_reauth called"
print("_do_reauth called")
try:
if self.auth_try != 1:
self._reauth()
@ -231,12 +230,12 @@ class HTTPJSONRESTClient(httplib2.Http):
resp, body = self._time_request(self.api_url + url, method,
**kwargs)
return resp, body
except exceptions.HTTPUnauthorized, ex:
print "_CS_REQUEST HTTPUnauthorized"
except exceptions.HTTPUnauthorized as ex:
print("_CS_REQUEST HTTPUnauthorized")
resp, body = self._do_reauth(url, method, ex, **kwargs)
return resp, body
except exceptions.HTTPForbidden, ex:
print "_CS_REQUEST HTTPForbidden"
except exceptions.HTTPForbidden as ex:
print("_CS_REQUEST HTTPForbidden")
resp, body = self._do_reauth(url, method, ex, **kwargs)
return resp, body

View File

@ -30,6 +30,7 @@ setup(
'Programming Language :: Python',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.0',
'Topic :: Internet :: WWW/HTTP',
]