diff --git a/CHANGES b/CHANGES index 3862bea..e917880 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,7 @@ +1.21.8 +_______ +- Raise AnalysisRateLimitError for all endpoints when rate limit exceeded error returning from server + 1.21.7 _______ - Raise AnalysisRateLimitError when analysis rejected due to rate limit exceeded error returning from server diff --git a/intezer_sdk/__init__.py b/intezer_sdk/__init__.py index 3bdbfad..50cf421 100644 --- a/intezer_sdk/__init__.py +++ b/intezer_sdk/__init__.py @@ -1 +1 @@ -__version__ = '1.21.7' +__version__ = '1.21.8' diff --git a/intezer_sdk/_api.py b/intezer_sdk/_api.py index c44d5c8..00b0f5a 100644 --- a/intezer_sdk/_api.py +++ b/intezer_sdk/_api.py @@ -801,6 +801,8 @@ def _assert_analysis_response_status_code(response: Response): raise errors.AnalysisIsAlreadyRunningError(response, running_analysis_id) elif response.status_code == HTTPStatus.FORBIDDEN: raise errors.InsufficientQuotaError(response) + elif response.status_code == HTTPStatus.TOO_MANY_REQUESTS: + raise errors.AnalysisRateLimitError(response) elif response.status_code == HTTPStatus.BAD_REQUEST: data = response.json() error = data.get('error', '') diff --git a/intezer_sdk/errors.py b/intezer_sdk/errors.py index 00d83ac..2daec82 100644 --- a/intezer_sdk/errors.py +++ b/intezer_sdk/errors.py @@ -151,7 +151,9 @@ def __init__(self, response: requests.Response): class AlertInProgressError(AlertError): def __init__(self, alert_id: str): - super().__init__(f'The alert {alert_id} is being processed at the moment, please try again later') + super().__init__( + f'The alert {alert_id} is being processed at the moment, please try again later' + ) class AlertNotFoundError(AlertError): @@ -178,6 +180,7 @@ class AnalysisSkippedByRuleError(ServerError): def __init__(self, response: requests.Response): super().__init__('Analysis skipped by rule', response) + class AnalysisRateLimitError(ServerError): def __init__(self, response: requests.Response): super().__init__('Analysis rate limit reached', response)