Fix to an issue with using XML as input for add_event() and update_event()

- also a change to the copy_list.py script to account for the change
pull/2/merge
Iglocska 2015-07-30 15:26:05 +02:00
parent e353faa1be
commit c315ecaef6
2 changed files with 4 additions and 3 deletions

View File

@ -4,6 +4,7 @@
import sys
from pymisp import PyMISP
import json
from keys import cert, priv
@ -30,7 +31,7 @@ def init(cert_to_priv=True):
def _to_utf8(request):
to_return = None
if 'json' in request.headers['content-type']:
to_return = request.json()
to_return = json.dumps(request.json())
else:
to_return = request.text.encode('utf-8')
return to_return

View File

@ -84,7 +84,7 @@ class PyMISP(object):
:param event: Event object to add
"""
session = self.__prepare_session()
return session.post(self.url, data=json.dumps(event))
return session.post(self.url, data=event)
def update_event(self, event_id, event):
"""
@ -94,7 +94,7 @@ class PyMISP(object):
:param event: Elements to add
"""
session = self.__prepare_session()
return session.post(self.rest.format(event_id), data=json.dumps(event))
return session.post(self.rest.format(event_id), data=event)
def delete_event(self, event_id):
"""