arpakitlib 1.5.29__py3-none-any.whl → 1.5.30__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 +13 -11
- arpakitlib/ar_schedule_uust_api_client.py +2 -10
- {arpakitlib-1.5.29.dist-info → arpakitlib-1.5.30.dist-info}/METADATA +1 -1
- {arpakitlib-1.5.29.dist-info → arpakitlib-1.5.30.dist-info}/RECORD +7 -7
- {arpakitlib-1.5.29.dist-info → arpakitlib-1.5.30.dist-info}/LICENSE +0 -0
- {arpakitlib-1.5.29.dist-info → arpakitlib-1.5.30.dist-info}/NOTICE +0 -0
- {arpakitlib-1.5.29.dist-info → arpakitlib-1.5.30.dist-info}/WHEEL +0 -0
@@ -19,17 +19,18 @@ def sync_make_request(
|
|
19
19
|
*,
|
20
20
|
method: str = "GET",
|
21
21
|
url: str,
|
22
|
-
|
22
|
+
max_tries_: int = 9,
|
23
23
|
proxy_url_: str | None = None,
|
24
24
|
raise_for_status_: bool = False,
|
25
|
+
timeout_: timedelta = timedelta(seconds=15).total_seconds(),
|
25
26
|
**kwargs
|
26
27
|
) -> requests.Response:
|
27
28
|
tries_counter = 0
|
28
29
|
|
29
30
|
kwargs["method"] = method
|
30
31
|
kwargs["url"] = url
|
31
|
-
if
|
32
|
-
kwargs["timeout"] =
|
32
|
+
if timeout_ is not None:
|
33
|
+
kwargs["timeout"] = timeout_.total_seconds()
|
33
34
|
if proxy_url_:
|
34
35
|
kwargs["proxies"] = {
|
35
36
|
"http": proxy_url_,
|
@@ -47,8 +48,8 @@ def sync_make_request(
|
|
47
48
|
response.raise_for_status()
|
48
49
|
return response
|
49
50
|
except BaseException as exception:
|
50
|
-
_logger.warning(f"{tries_counter}/{
|
51
|
-
if tries_counter >=
|
51
|
+
_logger.warning(f"{tries_counter}/{max_tries_} {method} {url} {exception}")
|
52
|
+
if tries_counter >= max_tries_:
|
52
53
|
raise exception
|
53
54
|
sync_safe_sleep(timedelta(seconds=0.1).total_seconds())
|
54
55
|
continue
|
@@ -58,18 +59,19 @@ async def async_make_request(
|
|
58
59
|
*,
|
59
60
|
method: str = "GET",
|
60
61
|
url: str,
|
61
|
-
|
62
|
+
max_tries_: int = 9,
|
62
63
|
proxy_url_: str | None = None,
|
63
64
|
raise_for_status_: bool = False,
|
65
|
+
timeout_: timedelta | None = timedelta(seconds=15),
|
64
66
|
**kwargs
|
65
67
|
) -> aiohttp.ClientResponse:
|
66
68
|
tries_counter = 0
|
67
69
|
|
68
70
|
kwargs["method"] = method
|
69
71
|
kwargs["url"] = url
|
70
|
-
if
|
71
|
-
kwargs["timeout"] = aiohttp.ClientTimeout(total=
|
72
|
-
if "allow_redirects" in kwargs:
|
72
|
+
if timeout_ is not None:
|
73
|
+
kwargs["timeout"] = aiohttp.ClientTimeout(total=timeout_.total_seconds())
|
74
|
+
if "allow_redirects" not in kwargs:
|
73
75
|
kwargs["allow_redirects"] = True
|
74
76
|
|
75
77
|
proxy_connector: ProxyConnector | None = None
|
@@ -87,8 +89,8 @@ async def async_make_request(
|
|
87
89
|
await response.read()
|
88
90
|
return response
|
89
91
|
except BaseException as exception:
|
90
|
-
_logger.warning(f"{tries_counter}/{
|
91
|
-
if tries_counter >=
|
92
|
+
_logger.warning(f"{tries_counter}/{max_tries_} {method} {url} {exception}")
|
93
|
+
if tries_counter >= max_tries_:
|
92
94
|
raise exception
|
93
95
|
await async_safe_sleep(timedelta(seconds=0.1).total_seconds())
|
94
96
|
continue
|
@@ -10,7 +10,6 @@ import pytz
|
|
10
10
|
|
11
11
|
from arpakitlib.ar_dict_util import combine_dicts
|
12
12
|
from arpakitlib.ar_http_request_util import async_make_request
|
13
|
-
from arpakitlib.ar_logging_util import setup_normal_logging
|
14
13
|
from arpakitlib.ar_type_util import raise_for_type
|
15
14
|
|
16
15
|
_ARPAKIT_LIB_MODULE_VERSION = "3.0"
|
@@ -76,13 +75,11 @@ class ScheduleUUSTAPIClient:
|
|
76
75
|
url: str,
|
77
76
|
params: dict | None = None
|
78
77
|
) -> dict[str, Any]:
|
79
|
-
params = combine_dicts(self.auth_params(), params)
|
80
78
|
response = await async_make_request(
|
81
79
|
url=url,
|
82
80
|
method="GET",
|
83
|
-
params=params,
|
81
|
+
params=combine_dicts(params, self.auth_params()),
|
84
82
|
proxy_url_=self.api_proxy_url,
|
85
|
-
max_tries=9
|
86
83
|
)
|
87
84
|
json_data = await response.json()
|
88
85
|
raise_for_type(json_data, dict)
|
@@ -190,12 +187,7 @@ def __example():
|
|
190
187
|
|
191
188
|
|
192
189
|
async def __async_example():
|
193
|
-
|
194
|
-
client = ScheduleUUSTAPIClient(
|
195
|
-
api_login="arpakit",
|
196
|
-
api_password_first_part="bAEb2wXJNNZ8"
|
197
|
-
)
|
198
|
-
await client.check_all()
|
190
|
+
pass
|
199
191
|
|
200
192
|
|
201
193
|
if __name__ == '__main__':
|
@@ -40,7 +40,7 @@ arpakitlib/ar_fastapi_util.py,sha256=zru-le-J139KpLlPeo9DUjMuDygh4tR2GhAJjlr7ROs
|
|
40
40
|
arpakitlib/ar_file_storage_in_dir.py,sha256=D3e3rGuHoI6xqAA5mVvEpVVpOWY1jyjNsjj2UhyHRbE,3674
|
41
41
|
arpakitlib/ar_generate_env_example.py,sha256=WseNlk_So6mTVQ2amMuigWYV4ZVmd940POvXtodoYj0,325
|
42
42
|
arpakitlib/ar_hash_util.py,sha256=Iqy6KBAOLBQMFLWv676boI5sV7atT2B-fb7aCdHOmIQ,340
|
43
|
-
arpakitlib/ar_http_request_util.py,sha256=
|
43
|
+
arpakitlib/ar_http_request_util.py,sha256=DooIL24jW6Ouz771TMTTvzDZETBc12R1RBmbXp9vNqg,3129
|
44
44
|
arpakitlib/ar_ip_util.py,sha256=aEAa1Hvobh9DWX7cmBAPLqnXSTiKe2hRk-WJaiKMaI8,1009
|
45
45
|
arpakitlib/ar_json_db.py,sha256=CEyhIU4WuNmX5mqwBVYxUKSdpFelXvWmf_tJ1fuxMSE,7187
|
46
46
|
arpakitlib/ar_json_util.py,sha256=S8CskZ3uoYuJGCy1GhQ8Ikhn-fxXk-9JpLUbBvXADqI,833
|
@@ -55,7 +55,7 @@ arpakitlib/ar_operation_execution_util.py,sha256=i-GDXFCAXrPwi-juH1sKWNsIPQZ036Q
|
|
55
55
|
arpakitlib/ar_parse_command.py,sha256=qpr2OwG3Bf7DFiL9S3iWgtbvtE80RSC35E5zFJvjG1I,2714
|
56
56
|
arpakitlib/ar_postgresql_util.py,sha256=SAHEmAyMkZe516uk2gS830v_Wn2kRUZUYNcTNwmgXJk,1160
|
57
57
|
arpakitlib/ar_run_cmd.py,sha256=D_rPavKMmWkQtwvZFz-Io5Ak8eSODHkcFeLPzNVC68g,1072
|
58
|
-
arpakitlib/ar_schedule_uust_api_client.py,sha256=
|
58
|
+
arpakitlib/ar_schedule_uust_api_client.py,sha256=1JGUy6rrjAXdWjeAqiAOQlCAEV3xuc5FUDWfXODKB-A,5770
|
59
59
|
arpakitlib/ar_sleep_util.py,sha256=9ZN4Qo4eZ_q3hjM7vNBQjFRcH-9-sqv3QLSjnxVJE90,1405
|
60
60
|
arpakitlib/ar_sqlalchemy_model_util.py,sha256=3zscvaloi9XY1NR70rJ4-jJlFUIqhmTbQ9wdvK-Yjf8,1379
|
61
61
|
arpakitlib/ar_ssh_runner.py,sha256=jlnss4V4pziBN1rBzoK_lDiWm6nMOqGXfa6NFJSKH-Y,6796
|
@@ -63,8 +63,8 @@ arpakitlib/ar_str_util.py,sha256=xSEzmsDvRiZVaxyqFFjcgzpphktCbXg2FHcvsd1DYpA,188
|
|
63
63
|
arpakitlib/ar_type_util.py,sha256=-h-SCsVl11eVo1u4hy2Asn0IfD5TIxmX3Ndug4AvnPE,1761
|
64
64
|
arpakitlib/ar_yookassa_api_client.py,sha256=BwsTygaXf35AACVBl_09uYlSD_t-U1OOzbj58OOFT4Q,6480
|
65
65
|
arpakitlib/ar_zabbix_util.py,sha256=MTQbmS0QpNCKNOGONNQHf6j7KTZsKGlIbd5rCH0R0WI,6313
|
66
|
-
arpakitlib-1.5.
|
67
|
-
arpakitlib-1.5.
|
68
|
-
arpakitlib-1.5.
|
69
|
-
arpakitlib-1.5.
|
70
|
-
arpakitlib-1.5.
|
66
|
+
arpakitlib-1.5.30.dist-info/LICENSE,sha256=1jqWIkbnMxDfs_i0SXP5qbV6PHjBr1g8506oW7uPjfg,11347
|
67
|
+
arpakitlib-1.5.30.dist-info/METADATA,sha256=-MrOdtGHS5oI_5ygdbJYMxdl9xJQALm6cA60w0Kxbzk,2330
|
68
|
+
arpakitlib-1.5.30.dist-info/NOTICE,sha256=wHwmiq3wExfFfgMsE5U5TOBP9_l72ocIG82KurEels0,43
|
69
|
+
arpakitlib-1.5.30.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
70
|
+
arpakitlib-1.5.30.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|