b24api 0.3.4__tar.gz → 0.3.6__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: b24api
3
- Version: 0.3.4
3
+ Version: 0.3.6
4
4
  Summary: Bitrix24 API
5
5
  Requires-Python: >=3.11
6
6
  Description-Content-Type: text/markdown
@@ -54,7 +54,7 @@ class Bitrix24:
54
54
  http_response = self.client.post(
55
55
  f"{self.settings.webhook_url}{request.method}",
56
56
  headers={"Content-Type": "application/json"},
57
- json=request.model_dump()["parameters"],
57
+ json=request.model_dump(mode="json")["parameters"],
58
58
  )
59
59
 
60
60
  with contextlib.suppress(httpx.ResponseNotRead, json.JSONDecodeError, ValidationError):
@@ -1,7 +1,7 @@
1
1
  from datetime import datetime
2
2
  from typing import Annotated, Any, Self
3
3
 
4
- from pydantic import BaseModel, BeforeValidator, constr
4
+ from pydantic import BaseModel, BeforeValidator, field_validator
5
5
 
6
6
  from b24api.error import ApiResponseError, RetryApiResponseError
7
7
  from b24api.query import build_query
@@ -45,9 +45,18 @@ class ListRequest(Request):
45
45
  class ErrorResponse(BaseModel):
46
46
  """API error response."""
47
47
 
48
- error: constr(to_lower=True)
48
+ error: str | int
49
49
  error_description: str
50
50
 
51
+ @field_validator("error")
52
+ @classmethod
53
+ def error_to_lower_str(cls, value: Any) -> Any: # noqa: ANN401
54
+ if not isinstance(value, int):
55
+ value = str(value)
56
+ if isinstance(value, str):
57
+ value = value.lower()
58
+ return value
59
+
51
60
  def raise_error(self, retry_errors: list[str]) -> Self:
52
61
  if self.error in retry_errors:
53
62
  raise RetryApiResponseError(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: b24api
3
- Version: 0.3.4
3
+ Version: 0.3.6
4
4
  Summary: Bitrix24 API
5
5
  Requires-Python: >=3.11
6
6
  Description-Content-Type: text/markdown
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
5
5
 
6
6
  [project]
7
7
  name = "b24api"
8
- version = "0.3.4"
8
+ version = "0.3.6"
9
9
  description = "Bitrix24 API"
10
10
  readme = "README.md"
11
11
  requires-python = ">=3.11"
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