From 0b81823af046358d923228f4abcffa5f10cf8ad9 Mon Sep 17 00:00:00 2001 From: Ofir Date: Tue, 16 Jul 2024 13:06:08 +0300 Subject: [PATCH] fix for handling conflict error --- intezer_sdk/__init__.py | 2 +- intezer_sdk/api.py | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/intezer_sdk/__init__.py b/intezer_sdk/__init__.py index 6cef8d1..fe30879 100644 --- a/intezer_sdk/__init__.py +++ b/intezer_sdk/__init__.py @@ -1 +1 @@ -__version__ = '1.21.2' +__version__ = '1.21.3' diff --git a/intezer_sdk/api.py b/intezer_sdk/api.py index 7cf19d1..5578d74 100644 --- a/intezer_sdk/api.py +++ b/intezer_sdk/api.py @@ -45,9 +45,13 @@ def raise_for_status(response: requests.Response, if response.status_code == HTTPStatus.UNAUTHORIZED: raise errors.InvalidApiKeyError(response) elif response.status_code == HTTPStatus.CONFLICT: - is_skipped_by_rule = response.json().get('result', {}).get('is_skipped_by_rule') - if is_skipped_by_rule: - raise errors.AnalysisSkippedByRuleError(response) + try: + is_skipped_by_rule = response.json().get('result', {}).get('is_skipped_by_rule') + if is_skipped_by_rule: + raise errors.AnalysisSkippedByRuleError(response) + except Exception: + pass + http_error_msg = f'{response.status_code} Client Error: {reason} for url: {response.url}' elif response.status_code == HTTPStatus.FORBIDDEN: try: error_message = response.json()['error']