From 4bad4ab4e2d62fc046e01590c6625470f8a01185 Mon Sep 17 00:00:00 2001 From: busya Date: Wed, 25 Feb 2026 20:52:12 +0300 Subject: [PATCH] fix(logging): suppress per-request belief scope spam in API client --- backend/src/core/utils/network.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/backend/src/core/utils/network.py b/backend/src/core/utils/network.py index 062b3de..361889c 100644 --- a/backend/src/core/utils/network.py +++ b/backend/src/core/utils/network.py @@ -203,10 +203,9 @@ class APIClient: # @PRE: APIClient is initialized and authenticated or can be authenticated. # @POST: Returns headers including auth tokens. def headers(self) -> Dict[str, str]: - with belief_scope("headers"): - if not self._authenticated: - self.authenticate() - return { + if not self._authenticated: + self.authenticate() + return { "Authorization": f"Bearer {self._tokens['access_token']}", "X-CSRFToken": self._tokens.get("csrf_token", ""), "Referer": self.base_url, @@ -225,8 +224,7 @@ class APIClient: # @RETURN: `requests.Response` если `raw_response=True`, иначе `dict`. # @THROW: SupersetAPIError, NetworkError и их подклассы. def request(self, method: str, endpoint: str, headers: Optional[Dict] = None, raw_response: bool = False, **kwargs) -> Union[requests.Response, Dict[str, Any]]: - with belief_scope("request"): - full_url = f"{self.base_url}{endpoint}" + full_url = f"{self.base_url}{endpoint}" _headers = self.headers.copy() if headers: _headers.update(headers) @@ -394,4 +392,4 @@ class APIClient: # [/DEF:APIClient:Class] -# [/DEF:backend.core.utils.network:Module] \ No newline at end of file +# [/DEF:backend.core.utils.network:Module]