mm-http 0.3.0__py3-none-any.whl → 0.3.1__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.
mm_http/response.py
CHANGED
|
@@ -10,7 +10,7 @@ from pydantic import BaseModel, model_validator
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
@enum.unique
|
|
13
|
-
class TransportErrorType(
|
|
13
|
+
class TransportErrorType(enum.StrEnum):
|
|
14
14
|
"""Transport-level error types."""
|
|
15
15
|
|
|
16
16
|
TIMEOUT = "timeout"
|
|
@@ -71,19 +71,6 @@ class HttpResponse(BaseModel):
|
|
|
71
71
|
return Result.ok(pydash.get(data, path))
|
|
72
72
|
return Result.ok(data)
|
|
73
73
|
|
|
74
|
-
def json_body_or_none(self, path: str | None = None) -> Any: # noqa: ANN401 - JSON returns dynamic types
|
|
75
|
-
"""Parse body as JSON. Returns None if body is None, JSON invalid, or path not found.
|
|
76
|
-
|
|
77
|
-
Warning: Do not use if None is a valid expected value — use json_body() instead.
|
|
78
|
-
"""
|
|
79
|
-
if self.body is None:
|
|
80
|
-
return None
|
|
81
|
-
try:
|
|
82
|
-
res = json.loads(self.body)
|
|
83
|
-
return pydash.get(res, path, None) if path else res
|
|
84
|
-
except json.JSONDecodeError:
|
|
85
|
-
return None
|
|
86
|
-
|
|
87
74
|
def get_header(self, name: str) -> str | None:
|
|
88
75
|
"""Get header value (case-insensitive)."""
|
|
89
76
|
if self.headers is None:
|
|
@@ -2,7 +2,7 @@ mm_http/__init__.py,sha256=UlnNFVFqi3qI07MbL7Cm3k3qaEmdUwv-H--6XvfLAEU,340
|
|
|
2
2
|
mm_http/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
3
|
mm_http/request.py,sha256=RjJ6QWwyQpIZ6jDhDufQ_R8AvDNvmbKb2VATUAYmVYA,5231
|
|
4
4
|
mm_http/request_sync.py,sha256=xQ0vgYJf4eSackna03GmV4h0iZvNPzWb535ts_oterE,2253
|
|
5
|
-
mm_http/response.py,sha256=
|
|
6
|
-
mm_http-0.3.
|
|
7
|
-
mm_http-0.3.
|
|
8
|
-
mm_http-0.3.
|
|
5
|
+
mm_http/response.py,sha256=Y7vmmvW9GUw0JJa9wuPFpbALdrP7K4WLtS4cHnwi1Xs,4370
|
|
6
|
+
mm_http-0.3.1.dist-info/METADATA,sha256=HRU-sIad-KmYeFw1DEsQc1ia2t4s7I1zPpLnz9AMAXo,275
|
|
7
|
+
mm_http-0.3.1.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
8
|
+
mm_http-0.3.1.dist-info/RECORD,,
|
|
File without changes
|