mm-std 0.1.0__py3-none-any.whl → 0.1.2__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_std/net.py
CHANGED
@@ -6,8 +6,8 @@ from json import JSONDecodeError
|
|
6
6
|
from typing import Any, TypeVar, cast
|
7
7
|
from urllib.parse import urlencode
|
8
8
|
|
9
|
+
import httpx
|
9
10
|
import pydash
|
10
|
-
import requests
|
11
11
|
|
12
12
|
from mm_std.result import Err, Ok, Result
|
13
13
|
|
@@ -93,33 +93,41 @@ def hrequest(
|
|
93
93
|
auth: Any = None,
|
94
94
|
verify: bool = True,
|
95
95
|
) -> HResponse:
|
96
|
+
query_params: dict[str, Any] | None = None
|
97
|
+
data: dict[str, Any] | None = None
|
98
|
+
json_: dict[str, Any] | None = None
|
96
99
|
method = method.upper()
|
97
|
-
proxies = {"http": proxy, "https": proxy} if proxy else None
|
98
100
|
if not headers:
|
99
101
|
headers = {}
|
100
|
-
|
102
|
+
if user_agent:
|
101
103
|
headers["user-agent"] = user_agent
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
104
|
+
if method == "GET":
|
105
|
+
query_params = params
|
106
|
+
elif json_params:
|
107
|
+
json_ = params
|
108
|
+
else:
|
109
|
+
data = params
|
110
|
+
|
111
|
+
try:
|
112
|
+
r = httpx.request(
|
113
|
+
method,
|
114
|
+
url,
|
115
|
+
proxy=proxy,
|
116
|
+
timeout=timeout,
|
117
|
+
cookies=cookies,
|
118
|
+
auth=auth,
|
119
|
+
verify=verify,
|
120
|
+
headers=headers,
|
121
|
+
params=query_params,
|
122
|
+
json=json_,
|
123
|
+
data=data,
|
124
|
+
)
|
117
125
|
return HResponse(code=r.status_code, body=r.text, headers=dict(r.headers))
|
118
|
-
except
|
126
|
+
except httpx.TimeoutException:
|
119
127
|
return HResponse(error="timeout")
|
120
|
-
except
|
128
|
+
except httpx.ProxyError:
|
121
129
|
return HResponse(error="proxy_error")
|
122
|
-
except
|
130
|
+
except httpx.HTTPError as err:
|
123
131
|
return HResponse(error=f"connection_error: {err}")
|
124
132
|
except Exception as err:
|
125
133
|
return HResponse(error=f"exception: {err}")
|
@@ -0,0 +1,12 @@
|
|
1
|
+
Metadata-Version: 2.3
|
2
|
+
Name: mm-std
|
3
|
+
Version: 0.1.2
|
4
|
+
Requires-Python: >=3.12
|
5
|
+
Requires-Dist: cryptography~=43.0.1
|
6
|
+
Requires-Dist: httpx[http2,socks]~=0.27.2
|
7
|
+
Requires-Dist: pydantic~=2.9.1
|
8
|
+
Requires-Dist: pydash~=8.0.0
|
9
|
+
Requires-Dist: python-dateutil~=2.9.0
|
10
|
+
Requires-Dist: python-dotenv~=1.0.1
|
11
|
+
Requires-Dist: pyyaml~=6.0.1
|
12
|
+
Requires-Dist: rich
|
@@ -9,7 +9,7 @@ mm_std/env.py,sha256=5zaR9VeIfObN-4yfgxoFeU5IM1GDeZZj9SuYf7t9sOA,125
|
|
9
9
|
mm_std/fs.py,sha256=RwarNRJq3tIMG6LVX_g03hasfYpjYFh_O27oVDt5IPQ,291
|
10
10
|
mm_std/json_.py,sha256=12uGLwmnrRA63QI0nUx-UU33zXcyShbsKCoOQiIJ8io,1016
|
11
11
|
mm_std/log.py,sha256=6ux6njNKc_ZCQlvWn1FZR6vcSY2Cem-mQzmNXvsg5IE,913
|
12
|
-
mm_std/net.py,sha256
|
12
|
+
mm_std/net.py,sha256=FIH_drMlf_ng-icI2w_mXiVyiLQUvJkskh3rQF8x8pM,4705
|
13
13
|
mm_std/print_.py,sha256=mMixwfdrLEYW15ez7_QxXdrV-d38q9XJP8tB8F7P2pI,1553
|
14
14
|
mm_std/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
15
15
|
mm_std/random_.py,sha256=KZauQzHsJaCVIeyHrJ74hiH34hdFE7pUxuv5i0Hl28g,1175
|
@@ -18,7 +18,6 @@ mm_std/str.py,sha256=nG5XF5870xM2PAvU0LZrJDk-d54LYwRLGnSahIekOVw,3151
|
|
18
18
|
mm_std/telegram.py,sha256=QrHPnsy0LTeqpd-g3RaHhk7gWIfHZEgnMs-S5DLW-vU,1220
|
19
19
|
mm_std/types.py,sha256=KpFtJ-BTmDfmmFeOSlgq6cMbCfGGOQjh1oWvdcrW-kw,116
|
20
20
|
mm_std/zip.py,sha256=2EXcae4HO5U4kObj2Lj8jl5F2OUpT-WRlJybTyFzt6I,370
|
21
|
-
mm_std-0.1.
|
22
|
-
mm_std-0.1.
|
23
|
-
mm_std-0.1.
|
24
|
-
mm_std-0.1.0.dist-info/RECORD,,
|
21
|
+
mm_std-0.1.2.dist-info/METADATA,sha256=RmNcgip4Asdyy-AgtdiPkJ9tv6vxg3qcBc9zcz8wYqE,335
|
22
|
+
mm_std-0.1.2.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
|
23
|
+
mm_std-0.1.2.dist-info/RECORD,,
|
mm_std-0.1.0.dist-info/METADATA
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
Metadata-Version: 2.1
|
2
|
-
Name: mm-std
|
3
|
-
Version: 0.1.0
|
4
|
-
Requires-Python: >=3.11
|
5
|
-
Requires-Dist: requests ~=2.32.3
|
6
|
-
Requires-Dist: PySocks ~=1.7.1
|
7
|
-
Requires-Dist: pydash ~=8.0.0
|
8
|
-
Requires-Dist: python-dateutil ~=2.9.0
|
9
|
-
Requires-Dist: pydantic ~=2.8.2
|
10
|
-
Requires-Dist: python-dotenv ~=1.0.1
|
11
|
-
Requires-Dist: PyYAML ~=6.0.1
|
12
|
-
Requires-Dist: cryptography ~=43.0.0
|
13
|
-
Requires-Dist: rich
|
14
|
-
Provides-Extra: dev
|
15
|
-
Requires-Dist: build ~=1.2.1 ; extra == 'dev'
|
16
|
-
Requires-Dist: twine ~=5.1.0 ; extra == 'dev'
|
17
|
-
Requires-Dist: pytest ~=8.3.2 ; extra == 'dev'
|
18
|
-
Requires-Dist: pytest-xdist ~=3.6.1 ; extra == 'dev'
|
19
|
-
Requires-Dist: pytest-httpserver ~=1.0.8 ; extra == 'dev'
|
20
|
-
Requires-Dist: coverage ~=7.6.0 ; extra == 'dev'
|
21
|
-
Requires-Dist: ruff ~=0.5.2 ; extra == 'dev'
|
22
|
-
Requires-Dist: pip-audit ~=2.7.0 ; extra == 'dev'
|
23
|
-
Requires-Dist: bandit ~=1.7.7 ; extra == 'dev'
|
24
|
-
Requires-Dist: mypy ~=1.11.0 ; extra == 'dev'
|
25
|
-
Requires-Dist: types-python-dateutil ~=2.9.0 ; extra == 'dev'
|
26
|
-
Requires-Dist: types-requests ~=2.32.0.20240523 ; extra == 'dev'
|
27
|
-
Requires-Dist: types-PyYAML ~=6.0.12.12 ; extra == 'dev'
|
28
|
-
|
@@ -1 +0,0 @@
|
|
1
|
-
mm_std
|