mm-http 0.2.2__py3-none-any.whl → 0.2.4__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/__init__.py +2 -2
- mm_http/response.py +9 -0
- {mm_http-0.2.2.dist-info → mm_http-0.2.4.dist-info}/METADATA +2 -1
- mm_http-0.2.4.dist-info/RECORD +8 -0
- mm_http-0.2.2.dist-info/RECORD +0 -8
- /mm_http/{http_request.py → request.py} +0 -0
- /mm_http/{http_request_sync.py → request_sync.py} +0 -0
- {mm_http-0.2.2.dist-info → mm_http-0.2.4.dist-info}/WHEEL +0 -0
mm_http/__init__.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
from .
|
|
2
|
-
from .
|
|
1
|
+
from .request import http_request
|
|
2
|
+
from .request_sync import http_request_sync
|
|
3
3
|
from .response import HttpResponse, TransportError, TransportErrorDetail
|
|
4
4
|
|
|
5
5
|
__all__ = ["HttpResponse", "TransportError", "TransportErrorDetail", "http_request", "http_request_sync"]
|
mm_http/response.py
CHANGED
|
@@ -82,6 +82,15 @@ class HttpResponse(BaseModel):
|
|
|
82
82
|
"""Check if response represents an error (has transport error or status >= 400)."""
|
|
83
83
|
return self.transport_error is not None or (self.status_code is not None and self.status_code >= 400)
|
|
84
84
|
|
|
85
|
+
@property
|
|
86
|
+
def error_message(self) -> str | None:
|
|
87
|
+
"""Get error message if transport_error is set or status_code >= 400, else None."""
|
|
88
|
+
if self.transport_error:
|
|
89
|
+
return f"{self.transport_error.type.value}: {self.transport_error.message}"
|
|
90
|
+
if self.status_code is not None and self.status_code >= 400:
|
|
91
|
+
return f"HTTP {self.status_code}"
|
|
92
|
+
return None
|
|
93
|
+
|
|
85
94
|
def to_result_err[T](self, error: str | Exception | tuple[str, Exception] | None = None) -> Result[T]:
|
|
86
95
|
"""Create error Result[T] from HttpResponse with meaningful error message."""
|
|
87
96
|
if error is not None:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mm-http
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.4
|
|
4
4
|
Requires-Python: >=3.13
|
|
5
5
|
Requires-Dist: aiohttp-socks~=0.11.0
|
|
6
6
|
Requires-Dist: aiohttp~=3.13.3
|
|
@@ -8,3 +8,4 @@ Requires-Dist: mm-result~=0.1.2
|
|
|
8
8
|
Requires-Dist: pydantic~=2.12.5
|
|
9
9
|
Requires-Dist: pydash~=8.0.5
|
|
10
10
|
Requires-Dist: requests[socks]~=2.32.5
|
|
11
|
+
Requires-Dist: urllib3~=2.6.3
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
mm_http/__init__.py,sha256=KQ5BhEyTpNXdV-gRYV8keh6_caee8jo8xuj292VWGTU,258
|
|
2
|
+
mm_http/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
+
mm_http/request.py,sha256=3uVkKiB89jL5o64SY-hyQV4iBlwLL8Pt4UekwU2zYVI,4569
|
|
4
|
+
mm_http/request_sync.py,sha256=2YjWAvWiut2HPcLMuwpCVMwpR99bmTQA3jYEutISKJE,2216
|
|
5
|
+
mm_http/response.py,sha256=WDRXNASFreDUGiUQk4QIelVP7qCPLWmNXsTd9uln-v8,4040
|
|
6
|
+
mm_http-0.2.4.dist-info/METADATA,sha256=GcZeadaz6uYk8CM-MjuTGDDBbqbBtRIKptMkRoa1qT0,305
|
|
7
|
+
mm_http-0.2.4.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
8
|
+
mm_http-0.2.4.dist-info/RECORD,,
|
mm_http-0.2.2.dist-info/RECORD
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
mm_http/__init__.py,sha256=-a5cUQa-Gr6xKErvlyJNApIb1itlL48xfi_pg-GMM7Y,268
|
|
2
|
-
mm_http/http_request.py,sha256=3uVkKiB89jL5o64SY-hyQV4iBlwLL8Pt4UekwU2zYVI,4569
|
|
3
|
-
mm_http/http_request_sync.py,sha256=2YjWAvWiut2HPcLMuwpCVMwpR99bmTQA3jYEutISKJE,2216
|
|
4
|
-
mm_http/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
|
-
mm_http/response.py,sha256=hoqVqLT4yzWxHYtkEGg0eTmAV530gvaB20WERQgpZpg,3634
|
|
6
|
-
mm_http-0.2.2.dist-info/METADATA,sha256=IL7oMFAhHSZSRwgax9qF2at0CGDTL7Pm1-a5wHAz6hs,275
|
|
7
|
-
mm_http-0.2.2.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
8
|
-
mm_http-0.2.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|