diff --git a/docs/changelog.rst b/docs/changelog.rst index cdede51..5a6acde 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -92,3 +92,5 @@ Changes in Version 2.0.1 ------------------------ * Allows suppressing of InsecureRequestWarning messages +* Changes the exception isinstance check to look for basestring/str instead of + bytes in order to properly store the error description. diff --git a/hpelefthandclient/exceptions.py b/hpelefthandclient/exceptions.py index f237085..7a25528 100644 --- a/hpelefthandclient/exceptions.py +++ b/hpelefthandclient/exceptions.py @@ -24,6 +24,12 @@ Exceptions for the client the REST calls """ +# Python 3+ override +try: + basestring +except NameError: + basestring = str + class UnsupportedVersion(Exception): """ @@ -65,7 +71,7 @@ class ClientException(Exception): if not error: return - if isinstance(error, str): + if isinstance(error, basestring): # instead of KeyError below, take it and make it the _error_desc. self._error_desc = error else: