mm-std 0.3.14__py3-none-any.whl → 0.3.15__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/http_.py CHANGED
@@ -3,6 +3,7 @@ from dataclasses import asdict, dataclass, field
3
3
  from typing import Any
4
4
  from urllib.parse import urlencode
5
5
 
6
+ import anyio
6
7
  import httpx
7
8
  import pydash
8
9
  import requests
@@ -170,31 +171,33 @@ async def async_hrequest(
170
171
  else:
171
172
  data = params
172
173
 
173
- try:
174
- async with httpx.AsyncClient(
175
- proxy=proxy,
176
- timeout=timeout,
177
- cookies=cookies,
178
- auth=auth,
179
- verify=verify,
180
- ) as client:
181
- r = await client.request(
182
- method,
183
- url,
184
- headers=headers,
185
- params=query_params,
186
- json=json_,
187
- data=data,
188
- )
189
- return HResponse(code=r.status_code, body=r.text, headers=dict(r.headers))
190
- except httpx.TimeoutException:
191
- return HResponse(error="timeout")
192
- except httpx.ProxyError:
193
- return HResponse(error="proxy_error")
194
- except httpx.RequestError as err:
195
- return HResponse(error=f"connection_error: {err}")
196
- except Exception as err:
197
- return HResponse(error=f"exception: {err}")
174
+ with anyio.move_on_after(timeout):
175
+ try:
176
+ async with httpx.AsyncClient(
177
+ proxy=proxy,
178
+ timeout=timeout,
179
+ cookies=cookies,
180
+ auth=auth,
181
+ verify=verify,
182
+ ) as client:
183
+ r = await client.request(
184
+ method,
185
+ url,
186
+ headers=headers,
187
+ params=query_params,
188
+ json=json_,
189
+ data=data,
190
+ )
191
+ return HResponse(code=r.status_code, body=r.text, headers=dict(r.headers))
192
+ except httpx.TimeoutException:
193
+ return HResponse(error="timeout")
194
+ except httpx.ProxyError:
195
+ return HResponse(error="proxy_error")
196
+ except httpx.RequestError as err:
197
+ return HResponse(error=f"connection_error: {err}")
198
+ except Exception as err:
199
+ return HResponse(error=f"exception: {err}")
200
+ return HResponse(error="timeout")
198
201
 
199
202
 
200
203
  def add_query_params_to_url(url: str, params: dict[str, object]) -> str:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mm-std
3
- Version: 0.3.14
3
+ Version: 0.3.15
4
4
  Requires-Python: >=3.12
5
5
  Requires-Dist: anyio>=4.9.0
6
6
  Requires-Dist: cryptography~=44.0.2
@@ -8,7 +8,7 @@ Requires-Dist: httpx[socks]>=0.28.1
8
8
  Requires-Dist: pydantic-settings>=2.8.1
9
9
  Requires-Dist: pydantic~=2.10.6
10
10
  Requires-Dist: pydash~=8.0.5
11
- Requires-Dist: python-dotenv~=1.0.1
11
+ Requires-Dist: python-dotenv~=1.1.0
12
12
  Requires-Dist: requests[socks]~=2.32.3
13
13
  Requires-Dist: rich~=13.9.4
14
14
  Requires-Dist: tomlkit~=0.13.2
@@ -6,7 +6,7 @@ mm_std/date.py,sha256=976eEkSONuNqHQBgSRu8hrtH23tJqztbmHFHLdbP2TY,1879
6
6
  mm_std/dict.py,sha256=6GkhJPXD0LiJDxPcYe6jPdEDw-MN7P7mKu6U5XxwYDk,675
7
7
  mm_std/env.py,sha256=5zaR9VeIfObN-4yfgxoFeU5IM1GDeZZj9SuYf7t9sOA,125
8
8
  mm_std/fs.py,sha256=RwarNRJq3tIMG6LVX_g03hasfYpjYFh_O27oVDt5IPQ,291
9
- mm_std/http_.py,sha256=JkyHZ29EOC6Ulqw_5eBNLmeMrca6NDGueTSwpj96aKM,6003
9
+ mm_std/http_.py,sha256=x5d4wnQcPlB_IYaYNCQGz7iOTEft8cQmMggHt30o7xI,6193
10
10
  mm_std/json_.py,sha256=Naa6mBE4D0yiQGkPNRrFvndnUH3R7ovw3FeaejWV60o,1196
11
11
  mm_std/log.py,sha256=6ux6njNKc_ZCQlvWn1FZR6vcSY2Cem-mQzmNXvsg5IE,913
12
12
  mm_std/net.py,sha256=qdRCBIDneip6FaPNe5mx31UtYVmzqam_AoUF7ydEyjA,590
@@ -25,6 +25,6 @@ mm_std/concurrency/async_task_runner.py,sha256=D4fD_hwSVy55sM_-U1_sdVYlkahnQeigX
25
25
  mm_std/concurrency/sync_decorators.py,sha256=syCQBOmN7qPO55yzgJB2rbkh10CVww376hmyvs6e5tA,1080
26
26
  mm_std/concurrency/sync_scheduler.py,sha256=j4tBL_cBI1spr0cZplTA7N2CoYsznuORMeRN8rpR6gY,2407
27
27
  mm_std/concurrency/sync_task_runner.py,sha256=s5JPlLYLGQGHIxy4oDS-PN7O9gcy-yPZFoNm8RQwzcw,1780
28
- mm_std-0.3.14.dist-info/METADATA,sha256=sH9DFjRqCXpYR3okXUVWFsTNlbyEk98QxYIfYGbFiXg,410
29
- mm_std-0.3.14.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
30
- mm_std-0.3.14.dist-info/RECORD,,
28
+ mm_std-0.3.15.dist-info/METADATA,sha256=HQY5RR2r6A77RPEc0_2wMT6QdKEFc6QyuzExC1f6fL8,410
29
+ mm_std-0.3.15.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
30
+ mm_std-0.3.15.dist-info/RECORD,,