potential fix for the errors not being picked up by pymisp from the response "errors" field

pull/55/head
iglocska 2017-02-22 09:03:47 +01:00
parent 0f6d7907c2
commit 13871dbd77
1 changed files with 6 additions and 1 deletions

View File

@ -203,9 +203,14 @@ class PyMISP(object):
errors.append(to_return['error']) errors.append(to_return['error'])
else: else:
errors += to_return['error'] 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 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']) errors.append(to_return['message'])
else: else:
errors.append(basestring(response.status_code)) errors.append(basestring(response.status_code))