diff --git a/pymisp/api.py b/pymisp/api.py index f902ef2..981779f 100644 --- a/pymisp/api.py +++ b/pymisp/api.py @@ -995,8 +995,8 @@ class PyMISP(object): """Helper to prepare a search query""" if query.get('error') is not None: return query - if controller not in ['events', 'attributes']: - raise Exception('Invalid controller. Can only be {}'.format(', '.join(['events', 'attributes']))) + if controller not in ['events', 'attributes', 'objects']: + raise ValueError('Invalid controller. Can only be {}'.format(', '.join(['events', 'attributes', 'objects']))) url = urljoin(self.root_url, '{}/{}'.format(controller, path.lstrip('/'))) if ASYNC_OK and async_callback: diff --git a/pymisp/mispevent.py b/pymisp/mispevent.py index 3199613..a0b71b1 100644 --- a/pymisp/mispevent.py +++ b/pymisp/mispevent.py @@ -435,7 +435,7 @@ class MISPEvent(AbstractMISP): if hasattr(json_event, 'read'): # python2 and python3 compatible to find if we have a file json_event = json_event.read() - if isinstance(json_event, basestring): + if isinstance(json_event, (basestring, bytes)): json_event = json.loads(json_event) if json_event.get('response'): event = json_event.get('response')[0] diff --git a/tests/mispevent_testfiles/event_obj_attr_tag.json b/tests/mispevent_testfiles/event_obj_attr_tag.json index 331bfc0..a258993 100644 --- a/tests/mispevent_testfiles/event_obj_attr_tag.json +++ b/tests/mispevent_testfiles/event_obj_attr_tag.json @@ -31,7 +31,7 @@ "name": "file", "sharing_group_id": 0, "template_uuid": "688c46fb-5edb-40a3-8273-1af7923e2215", - "template_version": 12, + "template_version": 13, "uuid": "a" }, { diff --git a/tests/mispevent_testfiles/event_obj_def_param.json b/tests/mispevent_testfiles/event_obj_def_param.json index 137617d..720a1f9 100644 --- a/tests/mispevent_testfiles/event_obj_def_param.json +++ b/tests/mispevent_testfiles/event_obj_def_param.json @@ -23,7 +23,7 @@ "name": "file", "sharing_group_id": 0, "template_uuid": "688c46fb-5edb-40a3-8273-1af7923e2215", - "template_version": 12, + "template_version": 13, "uuid": "a" }, { @@ -48,7 +48,7 @@ "name": "file", "sharing_group_id": 0, "template_uuid": "688c46fb-5edb-40a3-8273-1af7923e2215", - "template_version": 12, + "template_version": 13, "uuid": "b" } ]