arpakitlib 1.7.57__py3-none-any.whl → 1.7.58__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.
- arpakitlib/ar_http_request_util.py +18 -4
- {arpakitlib-1.7.57.dist-info → arpakitlib-1.7.58.dist-info}/METADATA +1 -1
- {arpakitlib-1.7.57.dist-info → arpakitlib-1.7.58.dist-info}/RECORD +7 -7
- {arpakitlib-1.7.57.dist-info → arpakitlib-1.7.58.dist-info}/LICENSE +0 -0
- {arpakitlib-1.7.57.dist-info → arpakitlib-1.7.58.dist-info}/NOTICE +0 -0
- {arpakitlib-1.7.57.dist-info → arpakitlib-1.7.58.dist-info}/WHEEL +0 -0
- {arpakitlib-1.7.57.dist-info → arpakitlib-1.7.58.dist-info}/entry_points.txt +0 -0
@@ -27,6 +27,7 @@ def sync_make_http_request(
|
|
27
27
|
proxy_url_: str | None = None,
|
28
28
|
raise_for_status_: bool = False,
|
29
29
|
timeout_: timedelta | float = timedelta(seconds=15).total_seconds(),
|
30
|
+
enable_logging_: bool = False,
|
30
31
|
**kwargs
|
31
32
|
) -> requests.Response:
|
32
33
|
if isinstance(timeout_, float):
|
@@ -51,7 +52,8 @@ def sync_make_http_request(
|
|
51
52
|
if "allow_redirects" not in kwargs:
|
52
53
|
kwargs["allow_redirects"] = True
|
53
54
|
|
54
|
-
|
55
|
+
if enable_logging_:
|
56
|
+
_logger.info(f"TRY HTTP {method} {url} {params}")
|
55
57
|
|
56
58
|
while True:
|
57
59
|
tries_counter += 1
|
@@ -59,9 +61,14 @@ def sync_make_http_request(
|
|
59
61
|
response = requests.request(**kwargs)
|
60
62
|
if raise_for_status_:
|
61
63
|
response.raise_for_status()
|
64
|
+
if enable_logging_:
|
65
|
+
_logger.info(f"GOOD TRY HTTP {method} {url} {params}")
|
62
66
|
return response
|
63
67
|
except BaseException as exception:
|
64
|
-
|
68
|
+
if enable_logging_:
|
69
|
+
_logger.warning(
|
70
|
+
f"{tries_counter}/{max_tries_}. RETRY {method} {url} {params}, exception={exception}"
|
71
|
+
)
|
65
72
|
if tries_counter >= max_tries_:
|
66
73
|
raise exception
|
67
74
|
sync_safe_sleep(timedelta(seconds=0.1).total_seconds())
|
@@ -78,6 +85,7 @@ async def async_make_http_request(
|
|
78
85
|
proxy_url_: str | None = None,
|
79
86
|
raise_for_status_: bool = False,
|
80
87
|
timeout_: timedelta | None = timedelta(seconds=15),
|
88
|
+
enable_logging_: bool = False,
|
81
89
|
**kwargs
|
82
90
|
) -> aiohttp.ClientResponse:
|
83
91
|
tries_counter = 0
|
@@ -97,7 +105,8 @@ async def async_make_http_request(
|
|
97
105
|
if proxy_url_:
|
98
106
|
proxy_connector = ProxyConnector.from_url(proxy_url_)
|
99
107
|
|
100
|
-
|
108
|
+
if enable_logging_:
|
109
|
+
_logger.info(f"TRY HTTP {method} {url} {params}")
|
101
110
|
|
102
111
|
while True:
|
103
112
|
tries_counter += 1
|
@@ -107,9 +116,14 @@ async def async_make_http_request(
|
|
107
116
|
if raise_for_status_:
|
108
117
|
response.raise_for_status()
|
109
118
|
await response.read()
|
119
|
+
if enable_logging_:
|
120
|
+
_logger.info(f"GOOD TRY HTTP {method} {url} {params}")
|
110
121
|
return response
|
111
122
|
except BaseException as exception:
|
112
|
-
|
123
|
+
if enable_logging_:
|
124
|
+
_logger.warning(
|
125
|
+
f"{tries_counter}/{max_tries_}. RETRY HTTP {method} {url} {params}, exception={exception}"
|
126
|
+
)
|
113
127
|
if tries_counter >= max_tries_:
|
114
128
|
raise exception
|
115
129
|
await async_safe_sleep(timedelta(seconds=0.1).total_seconds())
|
@@ -149,7 +149,7 @@ arpakitlib/ar_fastapi_util.py,sha256=e4Tgz7sPJk-wqMc2sNsBZ7ZVXo2lMnaOq5WY7CbgvMk
|
|
149
149
|
arpakitlib/ar_file_storage_in_dir_util.py,sha256=D3e3rGuHoI6xqAA5mVvEpVVpOWY1jyjNsjj2UhyHRbE,3674
|
150
150
|
arpakitlib/ar_file_util.py,sha256=07xCF7paAUP2JUyfpeX0l3N1oCSma7qAcBmrCIZVi3g,452
|
151
151
|
arpakitlib/ar_hash_util.py,sha256=Iqy6KBAOLBQMFLWv676boI5sV7atT2B-fb7aCdHOmIQ,340
|
152
|
-
arpakitlib/ar_http_request_util.py,sha256=
|
152
|
+
arpakitlib/ar_http_request_util.py,sha256=Kp2wKU4wGPsJ6m5sLwCEKWMs3Uqa59SUxhBevU6Gk_s,4328
|
153
153
|
arpakitlib/ar_ip_util.py,sha256=aEAa1Hvobh9DWX7cmBAPLqnXSTiKe2hRk-WJaiKMaI8,1009
|
154
154
|
arpakitlib/ar_json_db_util.py,sha256=CEyhIU4WuNmX5mqwBVYxUKSdpFelXvWmf_tJ1fuxMSE,7187
|
155
155
|
arpakitlib/ar_json_util.py,sha256=GwHDdrBWiJBHSc07Qe0aN1Gp_uM0pYpTwzU9JAgsKAo,972
|
@@ -174,9 +174,9 @@ arpakitlib/ar_str_util.py,sha256=oCEtQ_TTn35OEz9jCNLjbhopq76JmaifD_iYR-nEJJ4,214
|
|
174
174
|
arpakitlib/ar_type_util.py,sha256=e6Ch8I_B3FMJMj-fiZvTwtGde4hxSa48fGt5g8RlV6I,2301
|
175
175
|
arpakitlib/ar_yookassa_api_client_util.py,sha256=sh4fcUkAkdOetFn9JYoTvjcSXP-M1wU04KEY-ECLfLg,5137
|
176
176
|
arpakitlib/ar_zabbix_api_client_util.py,sha256=Q-VR4MvoZ9aHwZeYZr9G3LwN-ANx1T5KFmF6pvPM-9M,6402
|
177
|
-
arpakitlib-1.7.
|
178
|
-
arpakitlib-1.7.
|
179
|
-
arpakitlib-1.7.
|
180
|
-
arpakitlib-1.7.
|
181
|
-
arpakitlib-1.7.
|
182
|
-
arpakitlib-1.7.
|
177
|
+
arpakitlib-1.7.58.dist-info/LICENSE,sha256=GPEDQMam2r7FSTYqM1mm7aKnxLaWcBotH7UvQtea-ec,11355
|
178
|
+
arpakitlib-1.7.58.dist-info/METADATA,sha256=vWO-xc2jInkQXyY_TItpJ0UTbgsGRDbLUfFhiCI0VEw,2824
|
179
|
+
arpakitlib-1.7.58.dist-info/NOTICE,sha256=95aUzaPJjVpDsGAsNzVnq7tHTxAl0s5UFznCTkVCau4,763
|
180
|
+
arpakitlib-1.7.58.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
181
|
+
arpakitlib-1.7.58.dist-info/entry_points.txt,sha256=36xqR3PJFT2kuwjkM_EqoIy0qFUDPKSm_mJaI7emewE,87
|
182
|
+
arpakitlib-1.7.58.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|