b24api 0.4.0__tar.gz → 0.4.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {b24api-0.4.0/b24api.egg-info → b24api-0.4.1}/PKG-INFO +1 -1
- {b24api-0.4.0 → b24api-0.4.1}/b24api/api.py +5 -2
- {b24api-0.4.0 → b24api-0.4.1}/b24api/entity.py +3 -1
- {b24api-0.4.0 → b24api-0.4.1}/b24api/error.py +4 -9
- {b24api-0.4.0 → b24api-0.4.1/b24api.egg-info}/PKG-INFO +1 -1
- {b24api-0.4.0 → b24api-0.4.1}/LICENSE +0 -0
- {b24api-0.4.0 → b24api-0.4.1}/MANIFEST.in +0 -0
- {b24api-0.4.0 → b24api-0.4.1}/README.md +0 -0
- {b24api-0.4.0 → b24api-0.4.1}/b24api/__init__.py +0 -0
- {b24api-0.4.0 → b24api-0.4.1}/b24api/query.py +0 -0
- {b24api-0.4.0 → b24api-0.4.1}/b24api/settings.py +0 -0
- {b24api-0.4.0 → b24api-0.4.1}/b24api/type.py +0 -0
- {b24api-0.4.0 → b24api-0.4.1}/b24api.egg-info/SOURCES.txt +0 -0
- {b24api-0.4.0 → b24api-0.4.1}/b24api.egg-info/dependency_links.txt +0 -0
- {b24api-0.4.0 → b24api-0.4.1}/b24api.egg-info/requires.txt +0 -0
- {b24api-0.4.0 → b24api-0.4.1}/b24api.egg-info/top_level.txt +0 -0
- {b24api-0.4.0 → b24api-0.4.1}/pyproject.toml +0 -0
- {b24api-0.4.0 → b24api-0.4.1}/setup.cfg +0 -0
|
@@ -59,7 +59,7 @@ class Bitrix24:
|
|
|
59
59
|
)
|
|
60
60
|
|
|
61
61
|
with contextlib.suppress(httpx.ResponseNotRead, ValidationError):
|
|
62
|
-
ErrorResponse.model_validate_json(http_response.content).raise_error(self.settings.retry_errors)
|
|
62
|
+
ErrorResponse.model_validate_json(http_response.content).raise_error(request, self.settings.retry_errors)
|
|
63
63
|
|
|
64
64
|
try:
|
|
65
65
|
http_response.raise_for_status()
|
|
@@ -119,7 +119,10 @@ class Bitrix24:
|
|
|
119
119
|
key = f"_{i}"
|
|
120
120
|
|
|
121
121
|
if key in result.result_error:
|
|
122
|
-
ErrorResponse.model_validate(result.result_error[key]).raise_error(
|
|
122
|
+
ErrorResponse.model_validate(result.result_error[key]).raise_error(
|
|
123
|
+
commands[key],
|
|
124
|
+
self.settings.retry_errors,
|
|
125
|
+
)
|
|
123
126
|
|
|
124
127
|
command = commands[key]
|
|
125
128
|
if key not in result.result:
|
|
@@ -57,15 +57,17 @@ class ErrorResponse(BaseModel):
|
|
|
57
57
|
value = value.lower()
|
|
58
58
|
return value
|
|
59
59
|
|
|
60
|
-
def raise_error(self, retry_errors: list[str]) -> None:
|
|
60
|
+
def raise_error(self, request: Request, retry_errors: list[str]) -> None:
|
|
61
61
|
if self.error in retry_errors:
|
|
62
62
|
raise RetryApiResponseError(
|
|
63
63
|
code=self.error,
|
|
64
64
|
description=self.error_description,
|
|
65
|
+
request=str(request),
|
|
65
66
|
)
|
|
66
67
|
raise ApiResponseError(
|
|
67
68
|
code=self.error,
|
|
68
69
|
description=self.error_description,
|
|
70
|
+
request=str(request),
|
|
69
71
|
)
|
|
70
72
|
|
|
71
73
|
|
|
@@ -8,18 +8,13 @@ class RetryHTTPStatusError(httpx.HTTPStatusError):
|
|
|
8
8
|
class ApiResponseError(Exception):
|
|
9
9
|
"""API error with description."""
|
|
10
10
|
|
|
11
|
-
def __init__(
|
|
12
|
-
self,
|
|
13
|
-
*,
|
|
14
|
-
code: str,
|
|
15
|
-
description: str | None,
|
|
16
|
-
) -> None:
|
|
11
|
+
def __init__(self, *, code: str, description: str | None, request: str) -> None:
|
|
17
12
|
if code and description:
|
|
18
|
-
message = f"API error [{code}]: {description}"
|
|
13
|
+
message = f"API error [{code}]: {description} for request {request}"
|
|
19
14
|
elif code:
|
|
20
|
-
message = f"API error [{code}]"
|
|
15
|
+
message = f"API error [{code}] for request {request}"
|
|
21
16
|
else:
|
|
22
|
-
message = f"API error: {description}"
|
|
17
|
+
message = f"API error: {description} for request {request}"
|
|
23
18
|
super().__init__(message)
|
|
24
19
|
|
|
25
20
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|