arpakitlib 1.8.230__py3-none-any.whl → 1.8.232__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/_arpakit_project_template_v_5/arpakitlib_project_template_info.json +1 -1
- arpakitlib/_arpakit_project_template_v_5/project/api/router/admin/get_log_file.py +11 -3
- arpakitlib/raise_own_exception_if_exception.py +26 -12
- {arpakitlib-1.8.230.dist-info → arpakitlib-1.8.232.dist-info}/METADATA +1 -1
- {arpakitlib-1.8.230.dist-info → arpakitlib-1.8.232.dist-info}/RECORD +8 -8
- {arpakitlib-1.8.230.dist-info → arpakitlib-1.8.232.dist-info}/LICENSE +0 -0
- {arpakitlib-1.8.230.dist-info → arpakitlib-1.8.232.dist-info}/WHEEL +0 -0
- {arpakitlib-1.8.230.dist-info → arpakitlib-1.8.232.dist-info}/entry_points.txt +0 -0
@@ -1,7 +1,10 @@
|
|
1
|
+
import os
|
2
|
+
|
1
3
|
import fastapi
|
4
|
+
from arpakitlib.ar_datetime_util import now_utc_dt
|
5
|
+
from arpakitlib.ar_logging_util import init_log_file
|
2
6
|
from fastapi import APIRouter
|
3
7
|
|
4
|
-
from arpakitlib.ar_logging_util import init_log_file
|
5
8
|
from project.api.authorize import require_api_key_dbm_api_authorize_middleware, APIAuthorizeData, \
|
6
9
|
require_user_token_dbm_api_authorize_middleware, api_authorize
|
7
10
|
from project.core.settings import get_cached_settings
|
@@ -12,8 +15,9 @@ api_router = APIRouter()
|
|
12
15
|
|
13
16
|
@api_router.get(
|
14
17
|
path="",
|
15
|
-
name=
|
18
|
+
name=os.path.splitext(os.path.basename(__file__))[0].title(),
|
16
19
|
status_code=fastapi.status.HTTP_200_OK,
|
20
|
+
response_class=fastapi.responses.FileResponse
|
17
21
|
)
|
18
22
|
async def _(
|
19
23
|
*,
|
@@ -30,4 +34,8 @@ async def _(
|
|
30
34
|
]))
|
31
35
|
):
|
32
36
|
init_log_file(log_filepath=get_cached_settings().log_filepath)
|
33
|
-
return fastapi.responses.FileResponse(
|
37
|
+
return fastapi.responses.FileResponse(
|
38
|
+
path=get_cached_settings().log_filepath,
|
39
|
+
media_type="text/plain",
|
40
|
+
filename=f"story_{now_utc_dt().strftime('%d.%m.%Y_%H:%M_%Z%z')}.log"
|
41
|
+
)
|
@@ -16,6 +16,7 @@ def raise_own_exception_if_exception(
|
|
16
16
|
except_catching_exceptions: type[BaseException] | Tuple[type[BaseException], ...] | None = None,
|
17
17
|
own_exception: type[Exception],
|
18
18
|
kwargs_in_own_exception: dict[str, Any] | None = None,
|
19
|
+
forward_kwargs_in_own_exception: dict[str, Any] | None = None,
|
19
20
|
) -> (
|
20
21
|
Callable[[Callable[PARAMS_SPEC, RESULT_SPEC] | Callable[PARAMS_SPEC, Awaitable[RESULT_SPEC]]],
|
21
22
|
Callable[PARAMS_SPEC, RESULT_SPEC] | Callable[PARAMS_SPEC, Awaitable[RESULT_SPEC]]]
|
@@ -44,10 +45,11 @@ def raise_own_exception_if_exception(
|
|
44
45
|
else:
|
45
46
|
except_catching_exceptions = ()
|
46
47
|
|
47
|
-
kwargs_in_own_exception
|
48
|
-
|
49
|
-
|
50
|
-
|
48
|
+
if kwargs_in_own_exception is not None:
|
49
|
+
kwargs_in_own_exception = dict(kwargs_in_own_exception or {})
|
50
|
+
kwargs_in_own_exception["catching_exceptions"] = catching_exceptions
|
51
|
+
kwargs_in_own_exception["except_catching_exceptions"] = except_catching_exceptions
|
52
|
+
kwargs_in_own_exception["own_exception"] = own_exception
|
51
53
|
|
52
54
|
# Если явно передали пустой набор для ловли — возвращаем функцию как есть
|
53
55
|
if not catching_exceptions:
|
@@ -65,11 +67,17 @@ def raise_own_exception_if_exception(
|
|
65
67
|
except catching_exceptions as caught_exception: # ловим ТОЛЬКО нужные типы
|
66
68
|
if except_catching_exceptions and isinstance(caught_exception, except_catching_exceptions):
|
67
69
|
raise # пропускаем как есть
|
68
|
-
|
69
|
-
|
70
|
-
|
70
|
+
if kwargs_in_own_exception is not None:
|
71
|
+
copied_kwargs_in_own_exception = kwargs_in_own_exception.copy()
|
72
|
+
copied_kwargs_in_own_exception["caught_exception"] = caught_exception
|
73
|
+
copied_kwargs_in_own_exception["caught_exception_str"] = str(caught_exception)
|
71
74
|
try:
|
72
|
-
|
75
|
+
_kwargs = {}
|
76
|
+
if kwargs_in_own_exception is not None:
|
77
|
+
_kwargs = {"kwargs_": copied_kwargs_in_own_exception}
|
78
|
+
if forward_kwargs_in_own_exception is not None:
|
79
|
+
_kwargs.update(forward_kwargs_in_own_exception)
|
80
|
+
raise own_exception(**_kwargs) from caught_exception
|
73
81
|
except TypeError:
|
74
82
|
raise own_exception() from caught_exception
|
75
83
|
|
@@ -82,11 +90,17 @@ def raise_own_exception_if_exception(
|
|
82
90
|
except catching_exceptions as caught_exception:
|
83
91
|
if except_catching_exceptions and isinstance(caught_exception, except_catching_exceptions):
|
84
92
|
raise
|
85
|
-
|
86
|
-
|
87
|
-
|
93
|
+
if kwargs_in_own_exception is not None:
|
94
|
+
copied_kwargs_in_own_exception = kwargs_in_own_exception.copy()
|
95
|
+
copied_kwargs_in_own_exception["caught_exception"] = caught_exception
|
96
|
+
copied_kwargs_in_own_exception["caught_exception_str"] = str(caught_exception)
|
88
97
|
try:
|
89
|
-
|
98
|
+
_kwargs = {}
|
99
|
+
if kwargs_in_own_exception is not None:
|
100
|
+
_kwargs = {"kwargs_": copied_kwargs_in_own_exception}
|
101
|
+
if forward_kwargs_in_own_exception is not None:
|
102
|
+
_kwargs.update(forward_kwargs_in_own_exception)
|
103
|
+
raise own_exception(**_kwargs) from caught_exception
|
90
104
|
except TypeError:
|
91
105
|
raise own_exception() from caught_exception
|
92
106
|
|
@@ -8,7 +8,7 @@ arpakitlib/_arpakit_project_template_v_5/alembic/env.py,sha256=Qesmnj5A2kB-Doeuf
|
|
8
8
|
arpakitlib/_arpakit_project_template_v_5/alembic/script.py.mako,sha256=MEqL-2qATlST9TAOeYgscMn1uy6HUS9NFvDgl93dMj8,635
|
9
9
|
arpakitlib/_arpakit_project_template_v_5/alembic/versions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
10
10
|
arpakitlib/_arpakit_project_template_v_5/alembic.ini,sha256=8fuyeEvGBiPGbxEFy8ISBV3xX_fgVmuhEGpB10_B5Uo,3733
|
11
|
-
arpakitlib/_arpakit_project_template_v_5/arpakitlib_project_template_info.json,sha256=
|
11
|
+
arpakitlib/_arpakit_project_template_v_5/arpakitlib_project_template_info.json,sha256=dN2oKmHuIXZOFL1sBNYTX1n2YqT7tqoPZWGtuxXs1zg,98
|
12
12
|
arpakitlib/_arpakit_project_template_v_5/command/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
13
13
|
arpakitlib/_arpakit_project_template_v_5/command/alembic_history.sh,sha256=OMnDNtHIksGh9iavWnzbtxcudZW4vjdcISsBXvzZSPw,22
|
14
14
|
arpakitlib/_arpakit_project_template_v_5/command/alembic_revision_autogenerate.sh,sha256=yW2i-SBOtBx15Ya0poVQqKkJM5t2JZp06r9AEW-DmGE,46
|
@@ -106,7 +106,7 @@ arpakitlib/_arpakit_project_template_v_5/project/api/router/admin/clear_log_file
|
|
106
106
|
arpakitlib/_arpakit_project_template_v_5/project/api/router/admin/create_operation.py,sha256=aZFZzJM36knQIf2I2jCOjqzQ6nn70WgcPv88V18u8Ho,2358
|
107
107
|
arpakitlib/_arpakit_project_template_v_5/project/api/router/admin/get_arpakitlib_project_template_info.py,sha256=c4HAHSivR8viAlHVyTut4VaKNkYsYiabE833FsUl9Yk,1265
|
108
108
|
arpakitlib/_arpakit_project_template_v_5/project/api/router/admin/get_auth_data.py,sha256=Hpjkucwnb2LtytWpMMA2WMROY2cTLn0q_tnUFijk0so,1195
|
109
|
-
arpakitlib/_arpakit_project_template_v_5/project/api/router/admin/get_log_file.py,sha256=
|
109
|
+
arpakitlib/_arpakit_project_template_v_5/project/api/router/admin/get_log_file.py,sha256=bzkmLC2VPNY1JBFTYbbvjOS96FUwelj6FBt8LTukddI,1440
|
110
110
|
arpakitlib/_arpakit_project_template_v_5/project/api/router/admin/get_operation.py,sha256=cOG0c2s6grwvlN4xxXNyRVY28yI9u1xOryRt0fNHcko,2040
|
111
111
|
arpakitlib/_arpakit_project_template_v_5/project/api/router/admin/get_operation_allowed_statuses.py,sha256=eN-1XHeeSkgSTmYLldV-8uAY8qEmdUVCfvY2A5IHtw0,1096
|
112
112
|
arpakitlib/_arpakit_project_template_v_5/project/api/router/admin/get_operation_allowed_types.py,sha256=R5d3lZCHQNadPzG77WbJbLFQwTwPFU3l7BLYUlIOA6c,1090
|
@@ -421,9 +421,9 @@ arpakitlib/ar_type_util.py,sha256=Cs_tef-Fc5xeyAF54KgISCsP11NHyzIsglm4S3Xx7iM,40
|
|
421
421
|
arpakitlib/ar_yookassa_api_client_util.py,sha256=VozuZeCJjmLd1zj2BdC9WfiAQ3XYOrIMsdpNK-AUlm0,5347
|
422
422
|
arpakitlib/clone_pydantic_model_fields.py,sha256=xxLwtvJzDf8EWMvBE4psWIj8c-cyeCxLRX76oCY_4zk,1214
|
423
423
|
arpakitlib/pydantic_schema_from_sqlalchemy_model.py,sha256=_5Y79kQ4lLIOL6_afIFVwxY1EXzTMpi-veRR-WkPFOs,2879
|
424
|
-
arpakitlib/raise_own_exception_if_exception.py,sha256=
|
425
|
-
arpakitlib-1.8.
|
426
|
-
arpakitlib-1.8.
|
427
|
-
arpakitlib-1.8.
|
428
|
-
arpakitlib-1.8.
|
429
|
-
arpakitlib-1.8.
|
424
|
+
arpakitlib/raise_own_exception_if_exception.py,sha256=WCgrT0rwNMEAE__44TQaY4UXzRBKt-aJbMoOvTMGJVc,5541
|
425
|
+
arpakitlib-1.8.232.dist-info/LICENSE,sha256=GPEDQMam2r7FSTYqM1mm7aKnxLaWcBotH7UvQtea-ec,11355
|
426
|
+
arpakitlib-1.8.232.dist-info/METADATA,sha256=CaPTaSh0P_kdxE1DSMscXf9ZlxSKEkmn_1OC9hr55DI,3741
|
427
|
+
arpakitlib-1.8.232.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
428
|
+
arpakitlib-1.8.232.dist-info/entry_points.txt,sha256=36xqR3PJFT2kuwjkM_EqoIy0qFUDPKSm_mJaI7emewE,87
|
429
|
+
arpakitlib-1.8.232.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|