Skip to content

Commit

Permalink
Fix last commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Rafiot committed Jan 18, 2017
1 parent 2bcc416 commit f593ce6
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pymisp/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,20 +370,23 @@ def add_tag(self, event, tag, attribute=False):
session = self.__prepare_session()
if attribute:
to_post = {'request': {'Attribute': {'id': event['id'], 'tag': tag}}}
path = 'attributes/addTag'
else:
to_post = {'request': {'Event': {'id': event['id'], 'tag': tag}}}
response = session.post(urljoin(self.root_url, 'events/addTag'), data=json.dumps(to_post))
path = 'events/addTag'
response = session.post(urljoin(self.root_url, path), data=json.dumps(to_post))
return self._check_response(response)

def remove_tag(self, event, tag, attribute=False):
# FIXME: this is dirty, this function needs to be deprecated with something removing the tag to a UUID
session = self.__prepare_session()
if attribute:
to_post = {'request': {'Attribute': {'id': event['id'], 'tag': tag}}}
pass
path = 'attributes/addTag'
else:
to_post = {'request': {'Event': {'id': event['Event']['id'], 'tag': tag}}}
response = session.post(urljoin(self.root_url, 'events/removeTag'), data=json.dumps(to_post))
path = 'events/addTag'
response = session.post(urljoin(self.root_url, path), data=json.dumps(to_post))
return self._check_response(response)

def _valid_uuid(self, uuid):
Expand Down

0 comments on commit f593ce6

Please sign in to comment.