Skip to content

Commit

Permalink
fix for handling conflict error
Browse files Browse the repository at this point in the history
  • Loading branch information
ofirit committed Jul 16, 2024
1 parent 624e7f0 commit 0b81823
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion intezer_sdk/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '1.21.2'
__version__ = '1.21.3'
10 changes: 7 additions & 3 deletions intezer_sdk/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down

0 comments on commit 0b81823

Please sign in to comment.