on error response content is array with 1 element
This commit is contained in:
parent
f3808bf952
commit
f32190139b
1 changed files with 1 additions and 1 deletions
|
@ -127,7 +127,7 @@ class _ionosClient(object):
|
||||||
)
|
)
|
||||||
logger.debug("API REquest to URL: %s", url)
|
logger.debug("API REquest to URL: %s", url)
|
||||||
if resp.status_code != 200:
|
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']
|
error_msg = resp.reason + " " + content['message']
|
||||||
raise errors.PluginError(
|
raise errors.PluginError(
|
||||||
"HTTP Error during request {0}:{1}".format(resp.status_code, error_msg)
|
"HTTP Error during request {0}:{1}".format(resp.status_code, error_msg)
|
||||||
|
|
Loading…
Reference in a new issue