on error response content is array with 1 element

This commit is contained in:
helgeerbe 2021-10-07 10:35:45 +02:00
parent f3808bf952
commit f32190139b

View file

@ -127,7 +127,7 @@ class _ionosClient(object):
)
logger.debug("API REquest to URL: %s", url)
if resp.status_code != 200:
content = json.loads(resp.content)
content = json.loads(resp.content)[0] # on error content is array with 1 element
error_msg = resp.reason + " " + content['message']
raise errors.PluginError(
"HTTP Error during request {0}:{1}".format(resp.status_code, error_msg)