Allow to change the to_ids flag of an attribute

pull/36/head
Raphaël Vinot 2016-12-09 11:42:07 +01:00
parent 81faa507f4
commit 83c9ce9218
1 changed files with 11 additions and 1 deletions

View File

@ -655,6 +655,17 @@ class PyMISP(object):
session = self.__prepare_session() session = self.__prepare_session()
return self.__query_proposal(session, 'discard', proposal_id) 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 ######### # ######## REST Search #########
# ############################## # ##############################
@ -665,7 +676,6 @@ class PyMISP(object):
if controller not in ['events', 'attributes']: if controller not in ['events', 'attributes']:
raise Exception('Invalid controller. Can only be {}'.format(', '.join(['events', 'attributes']))) raise Exception('Invalid controller. Can only be {}'.format(', '.join(['events', 'attributes'])))
url = urljoin(self.root_url, '{}/{}'.format(controller, path.lstrip('/'))) url = urljoin(self.root_url, '{}/{}'.format(controller, path.lstrip('/')))
query = {'request': query}
if self.debug: if self.debug:
print('URL: ', url) print('URL: ', url)
print('Query: ', query) print('Query: ', query)