remove six in exceptions.py

Change-Id: Ibfd1d99979a8e5aae4b265358d92d073f7a0dc08
This commit is contained in:
XinxinShen 2021-01-06 19:25:45 +08:00
parent 29a5aa0880
commit 31fd85e032
1 changed files with 2 additions and 3 deletions

View File

@ -17,7 +17,6 @@ import inspect
import sys
from oslo_serialization import jsonutils
import six
from venusclient.i18n import _
@ -491,14 +490,14 @@ def from_response(response, method, url, message=None, traceback=None):
# {u'error_message': u'{"debuginfo": null, "faultcode":
# "Client", "faultstring": "error message"}'}, the
# "error_message" in the body is also a json string.
if isinstance(error, six.string_types):
if isinstance(error, str):
error = jsonutils.loads(error)
if hasattr(error, 'keys'):
kwargs['message'] = (error.get('message') or
error.get('faultstring'))
kwargs['details'] = (error.get('details') or
six.text_type(body))
str(body))
elif content_type.startswith("text/"):
kwargs["details"] = getattr(response, 'text', '')