Fix issue when adding multiple attributes and the instance is too slow.

Fix: https://github.com/MISP/MISP/issues/3293
pull/232/head
Raphaël Vinot 2018-05-30 15:41:09 +02:00
parent c99fef2129
commit 8c4889cc69
1 changed files with 6 additions and 1 deletions

View File

@ -509,7 +509,12 @@ class PyMISP(object):
else:
data = attributes.to_json()
# __prepare_request(...) returns a requests.Response Object
responses.append(self.__prepare_request('POST', url, json.dumps(data, cls=MISPEncode)).json())
resp = self.__prepare_request('POST', url, json.dumps(data, cls=MISPEncode))
try:
responses.append(resp.json())
except Exception:
# The response isn't a json object, appending the text.
responses.append(resp.text)
return responses
def _extract_event_id(self, event):