From 83c9ce92187e6582535b93dfb24dcd8bda7cb97e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Fri, 9 Dec 2016 11:42:07 +0100 Subject: [PATCH] Allow to change the to_ids flag of an attribute --- pymisp/api.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pymisp/api.py b/pymisp/api.py index 61a54ef..f240229 100644 --- a/pymisp/api.py +++ b/pymisp/api.py @@ -655,6 +655,17 @@ class PyMISP(object): session = self.__prepare_session() return self.__query_proposal(session, 'discard', proposal_id) + # ############################## + # ###### Attribute update ###### + # ############################## + + def change_toids(self, attribute_uuid, to_ids): + if to_ids not in [0, 1]: + raise Exception('to_ids can only be 0 or 1') + query = {"to_ids": to_ids} + session = self.__prepare_session() + return self.__query(session, 'edit/{}'.format(attribute_uuid), query, controller='attributes') + # ############################## # ######## REST Search ######### # ############################## @@ -665,7 +676,6 @@ class PyMISP(object): if controller not in ['events', 'attributes']: raise Exception('Invalid controller. Can only be {}'.format(', '.join(['events', 'attributes']))) url = urljoin(self.root_url, '{}/{}'.format(controller, path.lstrip('/'))) - query = {'request': query} if self.debug: print('URL: ', url) print('Query: ', query)