From 6ec25131849f96f460d134a9aa8ec04addf8d1ce Mon Sep 17 00:00:00 2001 From: fluxas Date: Wed, 3 May 2017 13:22:15 +0200 Subject: [PATCH] Add exception types to api.py --- pymisp/api.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pymisp/api.py b/pymisp/api.py index 263986b..c46e71a 100644 --- a/pymisp/api.py +++ b/pymisp/api.py @@ -140,7 +140,7 @@ class PyMISP(object): self.describe_types = describe_types['result'] if not self.describe_types.get('sane_defaults'): raise PyMISPError('The MISP server your are trying to reach is outdated (<2.4.52). Please use PyMISP v2.4.51.1 (pip install -I PyMISP==v2.4.51.1) and/or contact your administrator.') - except: + except Exception: with open(os.path.join(self.ressources_path, 'describeTypes.json'), 'r') as f: describe_types = json.load(f) self.describe_types = describe_types['result'] @@ -208,7 +208,7 @@ class PyMISP(object): response.raise_for_status() try: to_return = response.json() - except: + except ValueError: if self.debug: print(response.text) raise PyMISPError('Unknown error: {}'.format(response.text)) @@ -665,7 +665,7 @@ class PyMISP(object): if event_id is not None: try: event_id = int(event_id) - except: + except ValueError: pass if not isinstance(event_id, int): # New event