From f6dc99175181888bcda3f427fea7e3a88d429f74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Mon, 3 Apr 2017 10:04:59 +0200 Subject: [PATCH] Properly display deprecation warning --- pymisp/api.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/pymisp/api.py b/pymisp/api.py index 2eddc1d..1e52180 100644 --- a/pymisp/api.py +++ b/pymisp/api.py @@ -50,14 +50,14 @@ def deprecated(func): @functools.wraps(func) def new_func(*args, **kwargs): if sys.version_info < (3, 0): - warnings.warn_explicit( + warnings.showwarning( "Call to deprecated function {}.".format(func.__name__), category=DeprecationWarning, filename=func.func_code.co_filename, lineno=func.func_code.co_firstlineno + 1 ) else: - warnings.warn_explicit( + warnings.showwarning( "Call to deprecated function {}.".format(func.__name__), category=DeprecationWarning, filename=func.__code__.co_filename, @@ -1441,7 +1441,6 @@ class PyMISP(object): @deprecated def add_tag(self, event, tag, attribute=False): - # FIXME: this is dirty, this function needs to be deprecated with something tagging a UUID session = self.__prepare_session() if attribute: to_post = {'request': {'Attribute': {'id': event['id'], 'tag': tag}}} @@ -1457,13 +1456,12 @@ class PyMISP(object): @deprecated 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}}} - path = 'attributes/addTag' + path = 'attributes/removeTag' else: to_post = {'request': {'Event': {'id': event['Event']['id'], 'tag': tag}}} - path = 'events/addTag' + path = 'events/removeTag' response = session.post(urljoin(self.root_url, path), data=json.dumps(to_post)) return self._check_response(response)