road24-artifacthub 0.1.2__py3-none-any.whl → 0.1.3__py3-none-any.whl
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.
- {road24_artifacthub-0.1.2.dist-info → road24_artifacthub-0.1.3.dist-info}/METADATA +1 -1
- {road24_artifacthub-0.1.2.dist-info → road24_artifacthub-0.1.3.dist-info}/RECORD +4 -4
- road24_sdk/integrations/httpx.py +11 -2
- {road24_artifacthub-0.1.2.dist-info → road24_artifacthub-0.1.3.dist-info}/WHEEL +0 -0
|
@@ -6,13 +6,13 @@ road24_sdk/_types.py,sha256=OfRdYJhIAeMOtjPPCx-W9vXXAxYvuKjq37NzCubWIg8,1071
|
|
|
6
6
|
road24_sdk/integrations/__init__.py,sha256=uCtjD-5z2lQYA1j4jN9pFw1azS095L7BVtoxzz-Rl3c,497
|
|
7
7
|
road24_sdk/integrations/_base.py,sha256=IePXuVsvKmDDf3Aq411KzurXkkq5opelz9nqeXeCr2o,489
|
|
8
8
|
road24_sdk/integrations/fastapi.py,sha256=OZCb2iFULLDmID9MgyeQ6uGC0La8O8xvUPobI0CmQfA,9404
|
|
9
|
-
road24_sdk/integrations/httpx.py,sha256=
|
|
9
|
+
road24_sdk/integrations/httpx.py,sha256=ojCBoAuB8oUTnDfNG1i6Kn5lerbWAYh-OcxLHThp9OY,5443
|
|
10
10
|
road24_sdk/integrations/redis.py,sha256=KvLilhaZywGSrUJ4hL7T5BqfKGZWxSYQ7BADRVS5Fq0,7401
|
|
11
11
|
road24_sdk/integrations/sqlalchemy.py,sha256=WOhFpUt7RfknhJL253MxNif16OKK8GJlXQ87sDsN9WQ,5055
|
|
12
12
|
road24_sdk/metrics/__init__.py,sha256=vvXfTFdHYnYHkN9REgqvqiGsTkXnszVKXnqHkb5C1FQ,257
|
|
13
13
|
road24_sdk/metrics/db.py,sha256=Lqqy7k1qF8D9sdxEl4qDP5pwqVHXgo1ucDHgUYD4exs,780
|
|
14
14
|
road24_sdk/metrics/http.py,sha256=Ynbf-IvJwkzU6G2eRNWf99CH8ef-iR7CxfEvHR66OvQ,949
|
|
15
15
|
road24_sdk/metrics/redis.py,sha256=qdDuG-2px7_Hp1eiFRc4x8F0MG7KbcuiDiFxw8QsavA,805
|
|
16
|
-
road24_artifacthub-0.1.
|
|
17
|
-
road24_artifacthub-0.1.
|
|
18
|
-
road24_artifacthub-0.1.
|
|
16
|
+
road24_artifacthub-0.1.3.dist-info/METADATA,sha256=H65x4vBDOVaQfYx-ApKsbu_4hDDO472wM4pvnZbZ7XM,3722
|
|
17
|
+
road24_artifacthub-0.1.3.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
18
|
+
road24_artifacthub-0.1.3.dist-info/RECORD,,
|
road24_sdk/integrations/httpx.py
CHANGED
|
@@ -10,7 +10,7 @@ from road24_sdk._types import HttpDirection, LogType
|
|
|
10
10
|
from road24_sdk.integrations._base import Integration
|
|
11
11
|
|
|
12
12
|
if TYPE_CHECKING:
|
|
13
|
-
from httpx import AsyncClient, Request, Response
|
|
13
|
+
from httpx import AsyncClient, Request, RequestNotRead, Response
|
|
14
14
|
|
|
15
15
|
logger = logging.getLogger(__name__)
|
|
16
16
|
|
|
@@ -46,7 +46,7 @@ class HttpOutputLogger:
|
|
|
46
46
|
direction=HttpDirection.OUTPUT,
|
|
47
47
|
)
|
|
48
48
|
|
|
49
|
-
request_body = self.
|
|
49
|
+
request_body = self._get_request_body(request)
|
|
50
50
|
response_body = self._decode_body(response.content, response.headers.get("content-type"))
|
|
51
51
|
|
|
52
52
|
http_attrs = HttpAttributes(
|
|
@@ -63,6 +63,15 @@ class HttpOutputLogger:
|
|
|
63
63
|
log_level = self._get_log_level(response.status_code)
|
|
64
64
|
getattr(logger, log_level)(LogType.HTTP_REQUEST, extra=http_attrs.as_dict())
|
|
65
65
|
|
|
66
|
+
def _get_request_body(self, request: "Request") -> str:
|
|
67
|
+
from httpx import RequestNotRead
|
|
68
|
+
|
|
69
|
+
content_type = request.headers.get("content-type")
|
|
70
|
+
try:
|
|
71
|
+
return self._decode_body(request.content, content_type)
|
|
72
|
+
except RequestNotRead:
|
|
73
|
+
return "<streaming request>"
|
|
74
|
+
|
|
66
75
|
def _decode_body(self, content: bytes, content_type: str | None) -> str:
|
|
67
76
|
if not content:
|
|
68
77
|
return ""
|
|
File without changes
|