From 13871dbd77c4cec95d599579690096f58b6e15b8 Mon Sep 17 00:00:00 2001 From: iglocska Date: Wed, 22 Feb 2017 09:03:47 +0100 Subject: [PATCH] potential fix for the errors not being picked up by pymisp from the response "errors" field --- pymisp/api.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pymisp/api.py b/pymisp/api.py index 7465138..09d33b7 100644 --- a/pymisp/api.py +++ b/pymisp/api.py @@ -203,9 +203,14 @@ class PyMISP(object): errors.append(to_return['error']) else: errors += to_return['error'] + if to_return.get('errors'): + if not isinstance(to_return['errors'], list): + errors.append(to_return['errors']) + else: + errors += to_return['errors'] if 400 <= response.status_code < 500: - if to_return.get('error') is None and to_return.get('message'): + if not errors and to_return.get('message'): errors.append(to_return['message']) else: errors.append(basestring(response.status_code))