Modify to support Python 3.0
Update the code to change issue found by running 2to3 utility.
This commit is contained in:
parent
86e1c3178a
commit
52b5f42828
|
@ -24,11 +24,11 @@ HP LeftHand REST Client
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
version_tuple = (1, 0, 0)
|
version_tuple = (1, 0, 1)
|
||||||
|
|
||||||
|
|
||||||
def get_version_string():
|
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[:-1])) + version_tuple[-1]
|
||||||
return '.'.join(map(str, version_tuple))
|
return '.'.join(map(str, version_tuple))
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,6 @@ class HTTPJSONRESTClient(httplib2.Http):
|
||||||
def set_url(self, api_url):
|
def set_url(self, api_url):
|
||||||
#should be http://<Server:Port>/lhos
|
#should be http://<Server:Port>/lhos
|
||||||
self.api_url = api_url.rstrip('/')
|
self.api_url = api_url.rstrip('/')
|
||||||
self.api_url = self.api_url
|
|
||||||
|
|
||||||
def set_debug_flag(self, flag):
|
def set_debug_flag(self, flag):
|
||||||
"""
|
"""
|
||||||
|
@ -211,7 +210,7 @@ class HTTPJSONRESTClient(httplib2.Http):
|
||||||
return resp, body
|
return resp, body
|
||||||
|
|
||||||
def _do_reauth(self, url, method, ex, **kwargs):
|
def _do_reauth(self, url, method, ex, **kwargs):
|
||||||
print "_do_reauth called"
|
print("_do_reauth called")
|
||||||
try:
|
try:
|
||||||
if self.auth_try != 1:
|
if self.auth_try != 1:
|
||||||
self._reauth()
|
self._reauth()
|
||||||
|
@ -231,12 +230,12 @@ class HTTPJSONRESTClient(httplib2.Http):
|
||||||
resp, body = self._time_request(self.api_url + url, method,
|
resp, body = self._time_request(self.api_url + url, method,
|
||||||
**kwargs)
|
**kwargs)
|
||||||
return resp, body
|
return resp, body
|
||||||
except exceptions.HTTPUnauthorized, ex:
|
except exceptions.HTTPUnauthorized as ex:
|
||||||
print "_CS_REQUEST HTTPUnauthorized"
|
print("_CS_REQUEST HTTPUnauthorized")
|
||||||
resp, body = self._do_reauth(url, method, ex, **kwargs)
|
resp, body = self._do_reauth(url, method, ex, **kwargs)
|
||||||
return resp, body
|
return resp, body
|
||||||
except exceptions.HTTPForbidden, ex:
|
except exceptions.HTTPForbidden as ex:
|
||||||
print "_CS_REQUEST HTTPForbidden"
|
print("_CS_REQUEST HTTPForbidden")
|
||||||
resp, body = self._do_reauth(url, method, ex, **kwargs)
|
resp, body = self._do_reauth(url, method, ex, **kwargs)
|
||||||
return resp, body
|
return resp, body
|
||||||
|
|
||||||
|
|
1
setup.py
1
setup.py
|
@ -30,6 +30,7 @@ setup(
|
||||||
'Programming Language :: Python',
|
'Programming Language :: Python',
|
||||||
'Programming Language :: Python :: 2.6',
|
'Programming Language :: Python :: 2.6',
|
||||||
'Programming Language :: Python :: 2.7',
|
'Programming Language :: Python :: 2.7',
|
||||||
|
'Programming Language :: Python :: 3.0',
|
||||||
'Topic :: Internet :: WWW/HTTP',
|
'Topic :: Internet :: WWW/HTTP',
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in New Issue