From 8b511941b70ce864096e2e97b8c0a12d33c067b8 Mon Sep 17 00:00:00 2001 From: matan Date: Sun, 25 Oct 2026 12:53:52 +0200 Subject: [PATCH] feat(errors): add rule_id to AnalysisSkippedByRuleError When the server skips an analysis because a rule matched, the 409 body can carry the id of that rule under result.rule_id. Expose it on the error so callers can report which rule caused the skip without parsing the response. Co-Authored-By: Claude Fable 5.1 --- CHANGES | 4 ++++ intezer_sdk/__init__.py | 2 +- intezer_sdk/errors.py | 9 +++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index d91f6b4..67801e7 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,7 @@ +1.27.9 +------- +- Add rule_id to AnalysisSkippedByRuleError with the id of the rule that skipped the analysis + 1.27.8 ------- - Return None instead of raising when fetching a deleted analysis (410 Gone) by id, matching the documented from_analysis_id contract diff --git a/intezer_sdk/__init__.py b/intezer_sdk/__init__.py index 9630970..026e8ad 100644 --- a/intezer_sdk/__init__.py +++ b/intezer_sdk/__init__.py @@ -1 +1 @@ -__version__ = '1.27.8' +__version__ = '1.27.9' diff --git a/intezer_sdk/errors.py b/intezer_sdk/errors.py index a1a5737..086859b 100644 --- a/intezer_sdk/errors.py +++ b/intezer_sdk/errors.py @@ -198,6 +198,15 @@ def __init__(self, response: requests.Response): class AnalysisSkippedByRuleError(ServerError): def __init__(self, response: requests.Response): super().__init__('Analysis skipped by rule', response) + self.rule_id: str | None = self._parse_rule_id(response) + + @staticmethod + def _parse_rule_id(response: requests.Response) -> str | None: + try: + result = response.json().get('result') or {} + except ValueError: + return None + return result.get('rule_id') class AnalysisRateLimitError(ServerError):