arpakitlib 1.8.19__py3-none-any.whl → 1.8.21__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/example.env +1 -3
- arpakitlib/_arpakit_project_template_v_5/project/additional_model/common.py +0 -3
- arpakitlib/_arpakit_project_template_v_5/project/api/auth.py +170 -206
- arpakitlib/_arpakit_project_template_v_5/project/api/exception_handler.py +2 -7
- arpakitlib/_arpakit_project_template_v_5/project/api/router/admin/get_arpakitlib_project_template_info.py +11 -1
- arpakitlib/_arpakit_project_template_v_5/project/api/router/admin/get_auth_data.py +10 -8
- arpakitlib/_arpakit_project_template_v_5/project/api/router/admin/get_story_log.py +46 -0
- arpakitlib/_arpakit_project_template_v_5/project/api/router/admin/main_router.py +28 -0
- arpakitlib/_arpakit_project_template_v_5/project/api/router/admin/raise_fake_error.py +31 -0
- arpakitlib/_arpakit_project_template_v_5/project/api/router/admin/reinit_sqlalchemy_db.py +35 -0
- arpakitlib/_arpakit_project_template_v_5/project/api/router/client/get_current_user.py +33 -0
- arpakitlib/_arpakit_project_template_v_5/project/api/router/client/get_current_user_token.py +33 -0
- arpakitlib/_arpakit_project_template_v_5/project/api/router/client/get_errors_info.py +6 -8
- arpakitlib/_arpakit_project_template_v_5/project/api/router/client/main_router.py +17 -0
- arpakitlib/_arpakit_project_template_v_5/project/api/router/general/main_router.py +5 -1
- arpakitlib/_arpakit_project_template_v_5/project/api/router/{client → general}/now_utc_datetime.py +1 -1
- arpakitlib/_arpakit_project_template_v_5/project/api/schema/out/admin/common.py +7 -0
- arpakitlib/_arpakit_project_template_v_5/project/api/schema/out/admin/operation.py +2 -2
- arpakitlib/_arpakit_project_template_v_5/project/api/schema/out/admin/story_log.py +2 -2
- arpakitlib/_arpakit_project_template_v_5/project/api/schema/out/client/common.py +7 -0
- arpakitlib/_arpakit_project_template_v_5/project/api/schema/out/{admin → client}/user.py +6 -6
- arpakitlib/_arpakit_project_template_v_5/project/api/schema/out/client/user_token.py +14 -0
- arpakitlib/_arpakit_project_template_v_5/project/core/settings.py +3 -19
- arpakitlib/_arpakit_project_template_v_5/project/sqlalchemy_db_/sqlalchemy_model/api_key.py +1 -1
- arpakitlib/_arpakit_project_template_v_5/project/sqlalchemy_db_/sqlalchemy_model/operation.py +13 -3
- arpakitlib/_arpakit_project_template_v_5/project/sqlalchemy_db_/sqlalchemy_model/story_log.py +19 -4
- arpakitlib/_arpakit_project_template_v_5/project/sqlalchemy_db_/sqlalchemy_model/user.py +2 -2
- arpakitlib/_arpakit_project_template_v_5/project/sqlalchemy_db_/sqlalchemy_model/user_token.py +1 -1
- arpakitlib/_arpakit_project_template_v_5/project/test_data/make_test_api_keys.py +35 -0
- arpakitlib/_arpakit_project_template_v_5/project/test_data/make_test_data_1.py +4 -2
- arpakitlib/_arpakit_project_template_v_5/project/test_data/make_test_data_2.py +4 -2
- arpakitlib/_arpakit_project_template_v_5/project/test_data/make_test_data_3.py +4 -2
- arpakitlib/_arpakit_project_template_v_5/project/test_data/make_test_data_4.py +4 -2
- arpakitlib/_arpakit_project_template_v_5/project/test_data/make_test_data_5.py +4 -2
- arpakitlib/_arpakit_project_template_v_5/project/tg_bot/blank/client.py +14 -6
- arpakitlib/_arpakit_project_template_v_5/project/tg_bot/const.py +1 -0
- arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/{client → general}/about.py +1 -1
- arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/general/author.py +31 -0
- arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/{client → general}/support.py +1 -1
- arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/main_router.py +4 -3
- arpakitlib/_arpakit_project_template_v_5/project/tg_bot/util/set_tg_bot_commands.py +8 -0
- {arpakitlib-1.8.19.dist-info → arpakitlib-1.8.21.dist-info}/METADATA +1 -1
- {arpakitlib-1.8.19.dist-info → arpakitlib-1.8.21.dist-info}/RECORD +55 -49
- arpakitlib/_arpakit_project_template_v_5/project/api/auth2.py +0 -218
- arpakitlib/_arpakit_project_template_v_5/project/api/schema/out/admin/user_token.py +0 -14
- /arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/{client → general}/__init__.py +0 -0
- /arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/{client → general}/error_handler.py +0 -0
- /arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/{client → general}/healthcheck.py +0 -0
- /arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/{client → general}/hello_world.py +0 -0
- /arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/{client → general}/raw_callback_query.py +0 -0
- /arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/{client → general}/raw_inline_query.py +0 -0
- /arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/{client → general}/raw_message.py +0 -0
- /arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/{client → general}/remove_message.py +0 -0
- /arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/{client → general}/start.py +0 -0
- {arpakitlib-1.8.19.dist-info → arpakitlib-1.8.21.dist-info}/LICENSE +0 -0
- {arpakitlib-1.8.19.dist-info → arpakitlib-1.8.21.dist-info}/WHEEL +0 -0
- {arpakitlib-1.8.19.dist-info → arpakitlib-1.8.21.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,31 @@
|
|
1
|
+
import logging
|
2
|
+
|
3
|
+
import aiogram
|
4
|
+
from aiogram import Router
|
5
|
+
from aiogram.filters import Command, or_f
|
6
|
+
|
7
|
+
from project.tg_bot.blank.client import get_cached_client_tg_bot_blank
|
8
|
+
from project.tg_bot.const import ClientTgBotCommands
|
9
|
+
from project.tg_bot.filter_.message_text import MessageTextTgBotFilter
|
10
|
+
from project.tg_bot.middleware.common import MiddlewareDataTgBot
|
11
|
+
|
12
|
+
tg_bot_router = Router()
|
13
|
+
_logger = logging.getLogger(__name__)
|
14
|
+
|
15
|
+
|
16
|
+
@tg_bot_router.message(
|
17
|
+
or_f(
|
18
|
+
Command(ClientTgBotCommands.author),
|
19
|
+
MessageTextTgBotFilter([
|
20
|
+
ClientTgBotCommands.about,
|
21
|
+
"автор",
|
22
|
+
"авторы"
|
23
|
+
], ignore_case=True)
|
24
|
+
)
|
25
|
+
)
|
26
|
+
async def _(
|
27
|
+
m: aiogram.types.Message,
|
28
|
+
middleware_data_tg_bot: MiddlewareDataTgBot,
|
29
|
+
**kwargs
|
30
|
+
):
|
31
|
+
await m.answer(text=get_cached_client_tg_bot_blank().author())
|
@@ -3,8 +3,8 @@ from aiogram import Router
|
|
3
3
|
from project.tg_bot.router.admin import reinit_sqlalchemy_db, arpakitlib_project_template_info, raise_fake_error, me, \
|
4
4
|
log_file, clear_log_file, set_tg_bot_commands, init_sqlalchemy_db, drop_sqlalchemy_db, kb_with_remove_message, \
|
5
5
|
kb_with_old_cd, kb_with_raise_error, kb_with_not_modified
|
6
|
-
from project.tg_bot.router.
|
7
|
-
support, error_handler, raw_callback_query, raw_message, raw_inline_query
|
6
|
+
from project.tg_bot.router.general import remove_message, start, about, healthcheck, hello_world, \
|
7
|
+
support, error_handler, raw_callback_query, raw_message, raw_inline_query, author
|
8
8
|
|
9
9
|
main_tg_bot_router = Router()
|
10
10
|
|
@@ -23,7 +23,7 @@ main_tg_bot_router.include_router(router=kb_with_old_cd.tg_bot_router)
|
|
23
23
|
main_tg_bot_router.include_router(router=kb_with_raise_error.tg_bot_router)
|
24
24
|
main_tg_bot_router.include_router(router=kb_with_not_modified.tg_bot_router)
|
25
25
|
|
26
|
-
#
|
26
|
+
# general
|
27
27
|
main_tg_bot_router.include_router(router=error_handler.tg_bot_router)
|
28
28
|
main_tg_bot_router.include_router(router=remove_message.tg_bot_router)
|
29
29
|
main_tg_bot_router.include_router(router=start.tg_bot_router)
|
@@ -31,6 +31,7 @@ main_tg_bot_router.include_router(router=about.tg_bot_router)
|
|
31
31
|
main_tg_bot_router.include_router(router=healthcheck.tg_bot_router)
|
32
32
|
main_tg_bot_router.include_router(router=hello_world.tg_bot_router)
|
33
33
|
main_tg_bot_router.include_router(router=support.tg_bot_router)
|
34
|
+
main_tg_bot_router.include_router(router=author.tg_bot_router)
|
34
35
|
main_tg_bot_router.include_router(router=raw_message.tg_bot_router)
|
35
36
|
main_tg_bot_router.include_router(router=raw_inline_query.tg_bot_router)
|
36
37
|
main_tg_bot_router.include_router(router=raw_callback_query.tg_bot_router)
|
@@ -37,7 +37,15 @@ def get_client_tg_bot_commands_to_set() -> list[BotCommand]:
|
|
37
37
|
get_cached_client_tg_bot_blank().command_to_desc().get(ClientTgBotCommands.support),
|
38
38
|
ClientTgBotCommands.support
|
39
39
|
)
|
40
|
+
),
|
41
|
+
BotCommand(
|
42
|
+
command=ClientTgBotCommands.author,
|
43
|
+
description=return_str_if_none(
|
44
|
+
get_cached_client_tg_bot_blank().command_to_desc().get(ClientTgBotCommands.author),
|
45
|
+
ClientTgBotCommands.author
|
46
|
+
)
|
40
47
|
)
|
48
|
+
|
41
49
|
]
|
42
50
|
return res
|
43
51
|
|
@@ -67,7 +67,7 @@ arpakitlib/_arpakit_project_template_v_5/command/start_sqladmin_for_prod.py,sha2
|
|
67
67
|
arpakitlib/_arpakit_project_template_v_5/command/start_sqladmin_with_reload.py,sha256=KmbadM6bmsQfP23xTn8aBzlvCQ1J2rLAuFk0_RCChjs,374
|
68
68
|
arpakitlib/_arpakit_project_template_v_5/command/start_tg_bot.py,sha256=AJ1AxfdpbayBhScy6yAPVkSWnHJjzOTHxEewwGKaJMQ,200
|
69
69
|
arpakitlib/_arpakit_project_template_v_5/command/start_tg_bot_for_prod.py,sha256=AJ1AxfdpbayBhScy6yAPVkSWnHJjzOTHxEewwGKaJMQ,200
|
70
|
-
arpakitlib/_arpakit_project_template_v_5/example.env,sha256=
|
70
|
+
arpakitlib/_arpakit_project_template_v_5/example.env,sha256=8fsl0G7qVRmjRGXbafXwuQOlxTX1pU0-He77KC6pGeE,1014
|
71
71
|
arpakitlib/_arpakit_project_template_v_5/note/note_1.txt,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
72
72
|
arpakitlib/_arpakit_project_template_v_5/note/note_2.txt,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
73
73
|
arpakitlib/_arpakit_project_template_v_5/note/note_3.txt,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -75,30 +75,34 @@ arpakitlib/_arpakit_project_template_v_5/note/note_4.txt,sha256=47DEQpj8HBSa-_TI
|
|
75
75
|
arpakitlib/_arpakit_project_template_v_5/note/note_5.txt,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
76
76
|
arpakitlib/_arpakit_project_template_v_5/project/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
77
77
|
arpakitlib/_arpakit_project_template_v_5/project/additional_model/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
78
|
-
arpakitlib/_arpakit_project_template_v_5/project/additional_model/common.py,sha256=
|
78
|
+
arpakitlib/_arpakit_project_template_v_5/project/additional_model/common.py,sha256=BRz-B699ZY52DfUD6kmhpuThBWpPzpZpD0QXIjlkwC8,168
|
79
79
|
arpakitlib/_arpakit_project_template_v_5/project/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
80
80
|
arpakitlib/_arpakit_project_template_v_5/project/api/asgi.py,sha256=ES3YGwNxWUHVyD6e2ii6QkvTyB-vlVmr8_PhfVIXQ4Y,78
|
81
|
-
arpakitlib/_arpakit_project_template_v_5/project/api/auth.py,sha256=
|
82
|
-
arpakitlib/_arpakit_project_template_v_5/project/api/auth2.py,sha256=OCQ8zifsio7_4Pa7GGl40rkbcAYHcnCkO6ThF0J3aLg,9206
|
81
|
+
arpakitlib/_arpakit_project_template_v_5/project/api/auth.py,sha256=2UwEB5dcSERsVIjRYaK4dUtFcl7SLzszBVTz0awIIqo,13921
|
83
82
|
arpakitlib/_arpakit_project_template_v_5/project/api/const.py,sha256=J9bqaRRiIc3RLn6SJTvdfDvFrSsM_Ixii9t2M8dA5Jc,433
|
84
83
|
arpakitlib/_arpakit_project_template_v_5/project/api/create_api_app.py,sha256=-taA-OJ69donUlCUIl4tNxjHjRGnjwXl796lThef-uA,2284
|
85
84
|
arpakitlib/_arpakit_project_template_v_5/project/api/event.py,sha256=xKfJ3UnOx_g1s7KNZjWRp0eZbVRTsSlyJhT3wkfwT6k,2414
|
86
85
|
arpakitlib/_arpakit_project_template_v_5/project/api/exception.py,sha256=cNZaI2DacGLl8Hyn1qIfFpVjvQzOQjwXWsVW4auBrCo,1280
|
87
|
-
arpakitlib/_arpakit_project_template_v_5/project/api/exception_handler.py,sha256=
|
86
|
+
arpakitlib/_arpakit_project_template_v_5/project/api/exception_handler.py,sha256=Uyt0gB_8QnMFcZuNoUaEiAAJEjziWQpsXY1OM36e3YU,11125
|
88
87
|
arpakitlib/_arpakit_project_template_v_5/project/api/openapi_ui.py,sha256=PLhH-W6zDViO-75AGCs8Vq3IoyHChdqwBYAqLvdQN0U,904
|
89
88
|
arpakitlib/_arpakit_project_template_v_5/project/api/response.py,sha256=xZMymP2BuQaRNVWLeIp3UgUUo-MFN8MJnsn9Al4vOb8,1028
|
90
89
|
arpakitlib/_arpakit_project_template_v_5/project/api/router/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
91
90
|
arpakitlib/_arpakit_project_template_v_5/project/api/router/admin/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
92
|
-
arpakitlib/_arpakit_project_template_v_5/project/api/router/admin/get_arpakitlib_project_template_info.py,sha256=
|
93
|
-
arpakitlib/_arpakit_project_template_v_5/project/api/router/admin/get_auth_data.py,sha256=
|
94
|
-
arpakitlib/_arpakit_project_template_v_5/project/api/router/admin/
|
91
|
+
arpakitlib/_arpakit_project_template_v_5/project/api/router/admin/get_arpakitlib_project_template_info.py,sha256=VSnyxswDMrD4MEhLK77hrm4UYNHerzBV-92ASgEOqis,1293
|
92
|
+
arpakitlib/_arpakit_project_template_v_5/project/api/router/admin/get_auth_data.py,sha256=F_nqzPr2q6ssDv3RNqyn8CyRQBJ89rzpOHrgjkNYS8I,1216
|
93
|
+
arpakitlib/_arpakit_project_template_v_5/project/api/router/admin/get_story_log.py,sha256=DUSPKlXhITe5Ah5gq4d7dAls5H_K42AHj6pLSMZJ6RM,1785
|
94
|
+
arpakitlib/_arpakit_project_template_v_5/project/api/router/admin/main_router.py,sha256=dYjl8mrxCmQjTinqvimowzgYbLm_zAtYLYNWyvI3y10,814
|
95
|
+
arpakitlib/_arpakit_project_template_v_5/project/api/router/admin/raise_fake_error.py,sha256=I8g9PeguugvBZYrC4gzLtPBBoJw7U8joxYFmwqFW0mE,1088
|
96
|
+
arpakitlib/_arpakit_project_template_v_5/project/api/router/admin/reinit_sqlalchemy_db.py,sha256=IfjKMlDwkEt_fRcYxjCDZT1rYdpUXUhSoL4VyYTZzSA,1299
|
95
97
|
arpakitlib/_arpakit_project_template_v_5/project/api/router/client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
96
|
-
arpakitlib/_arpakit_project_template_v_5/project/api/router/client/
|
97
|
-
arpakitlib/_arpakit_project_template_v_5/project/api/router/client/
|
98
|
-
arpakitlib/_arpakit_project_template_v_5/project/api/router/client/
|
98
|
+
arpakitlib/_arpakit_project_template_v_5/project/api/router/client/get_current_user.py,sha256=q-ViMaj6dv09qYegh9ApbT1_tKFqqL-HlpvxCbeZWVw,1133
|
99
|
+
arpakitlib/_arpakit_project_template_v_5/project/api/router/client/get_current_user_token.py,sha256=9EsbkMg1nmTPyVbkb847DOo-HkFTZUpySeTOnVmqMbA,1155
|
100
|
+
arpakitlib/_arpakit_project_template_v_5/project/api/router/client/get_errors_info.py,sha256=55khAkCurF5DLhkFXDpb85ex5PULOLag9Z5EezMpUEs,1192
|
101
|
+
arpakitlib/_arpakit_project_template_v_5/project/api/router/client/main_router.py,sha256=S20kGyWjfPS0Ue1s8tpAqQsQlJ63m3uSSiOgKkHOuNk,514
|
99
102
|
arpakitlib/_arpakit_project_template_v_5/project/api/router/general/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
100
103
|
arpakitlib/_arpakit_project_template_v_5/project/api/router/general/healthcheck.py,sha256=xQNMi81IaroNE2H3LvYNUYV6X1dcGSeS2kAUSvGEcWA,523
|
101
|
-
arpakitlib/_arpakit_project_template_v_5/project/api/router/general/main_router.py,sha256=
|
104
|
+
arpakitlib/_arpakit_project_template_v_5/project/api/router/general/main_router.py,sha256=OPKujYKPInDozmfZrffQnMGtdwyxMBQv1k2f-LttMDY,356
|
105
|
+
arpakitlib/_arpakit_project_template_v_5/project/api/router/general/now_utc_datetime.py,sha256=4On6HXmhUuseuijWIIxuuzxZW1iHjnN_WsKQA8qdMsM,591
|
102
106
|
arpakitlib/_arpakit_project_template_v_5/project/api/router/main_router.py,sha256=Y-PPHWbLoICn0O8NRdx49f7ifEw2uN_QIRwfIseo0J0,615
|
103
107
|
arpakitlib/_arpakit_project_template_v_5/project/api/schema/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
104
108
|
arpakitlib/_arpakit_project_template_v_5/project/api/schema/common.py,sha256=DX6Yz63JHoNlgmZnpss2PuRgEtBh3PPlxM6wImYLpXo,718
|
@@ -112,13 +116,13 @@ arpakitlib/_arpakit_project_template_v_5/project/api/schema/in_/general/__init__
|
|
112
116
|
arpakitlib/_arpakit_project_template_v_5/project/api/schema/in_/general/common.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
113
117
|
arpakitlib/_arpakit_project_template_v_5/project/api/schema/out/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
114
118
|
arpakitlib/_arpakit_project_template_v_5/project/api/schema/out/admin/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
115
|
-
arpakitlib/_arpakit_project_template_v_5/project/api/schema/out/admin/common.py,sha256=
|
116
|
-
arpakitlib/_arpakit_project_template_v_5/project/api/schema/out/admin/operation.py,sha256=
|
117
|
-
arpakitlib/_arpakit_project_template_v_5/project/api/schema/out/admin/story_log.py,sha256=
|
118
|
-
arpakitlib/_arpakit_project_template_v_5/project/api/schema/out/admin/user.py,sha256=pae7J75tW9Oj-dCNks1J_9jUTq2TIoRiYPS6MCQuZXE,633
|
119
|
-
arpakitlib/_arpakit_project_template_v_5/project/api/schema/out/admin/user_token.py,sha256=VhD7OVewrsJmJcNG7Uzm29Dn6pDpsAa3X19-FyiXi3k,447
|
119
|
+
arpakitlib/_arpakit_project_template_v_5/project/api/schema/out/admin/common.py,sha256=b0s5VdLcH-sBvD9WFaVg-cek299ItBH8W0xn7JWaV78,445
|
120
|
+
arpakitlib/_arpakit_project_template_v_5/project/api/schema/out/admin/operation.py,sha256=8oPqCofV5KJMB6JB-Cozi_5l-2t8EPSvfossT0wIZBM,699
|
121
|
+
arpakitlib/_arpakit_project_template_v_5/project/api/schema/out/admin/story_log.py,sha256=EenBUvs9qENEGuCpZrBRSd4TNVjR-ER55g44QGPLAzY,482
|
120
122
|
arpakitlib/_arpakit_project_template_v_5/project/api/schema/out/client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
121
|
-
arpakitlib/_arpakit_project_template_v_5/project/api/schema/out/client/common.py,sha256=
|
123
|
+
arpakitlib/_arpakit_project_template_v_5/project/api/schema/out/client/common.py,sha256=cm7FAsZf5GlGAcR_w0tr2fR9gUMNcY--ifqE-BuFGpU,447
|
124
|
+
arpakitlib/_arpakit_project_template_v_5/project/api/schema/out/client/user.py,sha256=S93SizBPg5evgycr3Y_AF0Ds0M5gvO2o_W2VsDZXFeY,629
|
125
|
+
arpakitlib/_arpakit_project_template_v_5/project/api/schema/out/client/user_token.py,sha256=XRUs3ieMDZGGnMMst-QXptBWXqBL-qPQa25NJVbSI9I,436
|
122
126
|
arpakitlib/_arpakit_project_template_v_5/project/api/schema/out/common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
123
127
|
arpakitlib/_arpakit_project_template_v_5/project/api/schema/out/common/datetime_.py,sha256=YFo29Qc7JMVq-OR398kPy4ypjh9kYAxPuZZUsobhDdc,942
|
124
128
|
arpakitlib/_arpakit_project_template_v_5/project/api/schema/out/common/error.py,sha256=C8oaHotxmxBnN7Lr1qT7T5Mk0SIU2Ha7_tPDpgiR6M8,286
|
@@ -138,7 +142,7 @@ arpakitlib/_arpakit_project_template_v_5/project/core/const.py,sha256=hgiiPIYL95
|
|
138
142
|
arpakitlib/_arpakit_project_template_v_5/project/core/dump_file_storage_in_dir.py,sha256=u3-vStMGaseMsRLuJmQK04UDhaez9vw6o5jyHb1fwNg,617
|
139
143
|
arpakitlib/_arpakit_project_template_v_5/project/core/jinja2_templates.py,sha256=jCNLaBauGC7YNvZdTLNHuPp7hmRGt94O23Skg6ewo7o,352
|
140
144
|
arpakitlib/_arpakit_project_template_v_5/project/core/media_file_storage_in_dir.py,sha256=fMofTsfJtA8pp5lEUhucEUu3PBsmj-elaRZzExDsdLI,623
|
141
|
-
arpakitlib/_arpakit_project_template_v_5/project/core/settings.py,sha256=
|
145
|
+
arpakitlib/_arpakit_project_template_v_5/project/core/settings.py,sha256=UR9EM_Fw2WfVRACwrZTkJMMA5IV2YYiWa87qi_IcMvg,5828
|
142
146
|
arpakitlib/_arpakit_project_template_v_5/project/core/util.py,sha256=1ha9UrguVPsTSjoMHhVZVCD0_mNBfhIDGEvcG1nA4Zw,667
|
143
147
|
arpakitlib/_arpakit_project_template_v_5/project/json_db/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
144
148
|
arpakitlib/_arpakit_project_template_v_5/project/json_db/json_db.py,sha256=tBML-z4Y7uY8f_0ggcxvlDNt15Sf93Jr_OUeHwWxqOA,724
|
@@ -203,29 +207,30 @@ arpakitlib/_arpakit_project_template_v_5/project/sqlalchemy_db_/__init__.py,sha2
|
|
203
207
|
arpakitlib/_arpakit_project_template_v_5/project/sqlalchemy_db_/const.py,sha256=dcvj5C9E2F2KCsGZPBBncQf_EvVJAC1qQgnyD8P4ZEw,6
|
204
208
|
arpakitlib/_arpakit_project_template_v_5/project/sqlalchemy_db_/sqlalchemy_db.py,sha256=1y3FaMFzm_5UM2poqtBve_UP_mh1vjs--krq6yO8PsA,742
|
205
209
|
arpakitlib/_arpakit_project_template_v_5/project/sqlalchemy_db_/sqlalchemy_model/__init__.py,sha256=btSjCQ7RJqomeXzYs9HePCu1dZHs0z6-RuboYKG89_8,598
|
206
|
-
arpakitlib/_arpakit_project_template_v_5/project/sqlalchemy_db_/sqlalchemy_model/api_key.py,sha256=
|
210
|
+
arpakitlib/_arpakit_project_template_v_5/project/sqlalchemy_db_/sqlalchemy_model/api_key.py,sha256=a-xSHsnE8EkiH9g1ZoxaQQ7Y7q0urIm3SynlGYiSE8E,1038
|
207
211
|
arpakitlib/_arpakit_project_template_v_5/project/sqlalchemy_db_/sqlalchemy_model/common.py,sha256=yK0fFdRYZUpjWl8Vq9S9DKMLBkj9ZT9TXhGyPuR6asU,1876
|
208
|
-
arpakitlib/_arpakit_project_template_v_5/project/sqlalchemy_db_/sqlalchemy_model/operation.py,sha256=
|
209
|
-
arpakitlib/_arpakit_project_template_v_5/project/sqlalchemy_db_/sqlalchemy_model/story_log.py,sha256=
|
210
|
-
arpakitlib/_arpakit_project_template_v_5/project/sqlalchemy_db_/sqlalchemy_model/user.py,sha256=
|
211
|
-
arpakitlib/_arpakit_project_template_v_5/project/sqlalchemy_db_/sqlalchemy_model/user_token.py,sha256=
|
212
|
+
arpakitlib/_arpakit_project_template_v_5/project/sqlalchemy_db_/sqlalchemy_model/operation.py,sha256=4jahuEqTD7OgIDB1TDVDb7occhgid_TLpEBtbi8vu2E,3367
|
213
|
+
arpakitlib/_arpakit_project_template_v_5/project/sqlalchemy_db_/sqlalchemy_model/story_log.py,sha256=Hm6DTPAvK9f1WgIvBXBO00DAeienEXr3CZIVG_Odrfg,1383
|
214
|
+
arpakitlib/_arpakit_project_template_v_5/project/sqlalchemy_db_/sqlalchemy_model/user.py,sha256=lCgNR-SLUL6JN-Q1pstxGKF0PiSTKTWGzWANF5u9u7o,2354
|
215
|
+
arpakitlib/_arpakit_project_template_v_5/project/sqlalchemy_db_/sqlalchemy_model/user_token.py,sha256=9yGVRC4Ns1TgM7IOaZvbQWuiLYpxDTQKzitokpCGRoQ,1013
|
212
216
|
arpakitlib/_arpakit_project_template_v_5/project/sqlalchemy_db_/util.py,sha256=QSA_nT6aWdtE412-Uj3VTd7yh3dzS4HugDK9FivjTPo,570
|
213
217
|
arpakitlib/_arpakit_project_template_v_5/project/test_data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
214
|
-
arpakitlib/_arpakit_project_template_v_5/project/test_data/
|
215
|
-
arpakitlib/_arpakit_project_template_v_5/project/test_data/
|
216
|
-
arpakitlib/_arpakit_project_template_v_5/project/test_data/
|
217
|
-
arpakitlib/_arpakit_project_template_v_5/project/test_data/
|
218
|
-
arpakitlib/_arpakit_project_template_v_5/project/test_data/
|
218
|
+
arpakitlib/_arpakit_project_template_v_5/project/test_data/make_test_api_keys.py,sha256=0T2NXyh2Voy8SmtFNMvvD8HSPVz0OXjsQFDWig5pAAs,834
|
219
|
+
arpakitlib/_arpakit_project_template_v_5/project/test_data/make_test_data_1.py,sha256=fioAaw5sWtZdOuHsl1kbVxuU_g0IK8N-gyKlMzVi8FE,416
|
220
|
+
arpakitlib/_arpakit_project_template_v_5/project/test_data/make_test_data_2.py,sha256=VcCvxRLA0XnLaQcsaoZkIVV8rTO3uMyLTYoEsdxKtYE,416
|
221
|
+
arpakitlib/_arpakit_project_template_v_5/project/test_data/make_test_data_3.py,sha256=9QJTgM4qsJXPgFhfVueQ9vObXr_dAldzP_p8dPO42uA,416
|
222
|
+
arpakitlib/_arpakit_project_template_v_5/project/test_data/make_test_data_4.py,sha256=OyU9601WACF7cCpPT33x6CpizNJeQIPDDFezIvEO01A,416
|
223
|
+
arpakitlib/_arpakit_project_template_v_5/project/test_data/make_test_data_5.py,sha256=cew0ndlJspNkeQVOS0UPoceg1ARIm5ZFCzytiDIyvbg,416
|
219
224
|
arpakitlib/_arpakit_project_template_v_5/project/tg_bot/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
220
225
|
arpakitlib/_arpakit_project_template_v_5/project/tg_bot/blank/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
221
226
|
arpakitlib/_arpakit_project_template_v_5/project/tg_bot/blank/admin.py,sha256=RG9YRcOJAkS3Z4VNEnwyTnKj8Xb65gCZWta7NdGdxvU,1008
|
222
|
-
arpakitlib/_arpakit_project_template_v_5/project/tg_bot/blank/client.py,sha256=
|
227
|
+
arpakitlib/_arpakit_project_template_v_5/project/tg_bot/blank/client.py,sha256=vWd7GgXBMcBlLtkJByVSfX_NVSUUM6KUAeynUBySTV0,2477
|
223
228
|
arpakitlib/_arpakit_project_template_v_5/project/tg_bot/blank/common.py,sha256=HjJnKLQAdHtLLM73wURiFR2zzJEvkypVg0pMsKu5mKs,93
|
224
229
|
arpakitlib/_arpakit_project_template_v_5/project/tg_bot/callback/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
225
230
|
arpakitlib/_arpakit_project_template_v_5/project/tg_bot/callback/admin.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
226
231
|
arpakitlib/_arpakit_project_template_v_5/project/tg_bot/callback/client.py,sha256=8eJAc0mq8bX6BbP0eWY4NYToFOFSUXB-nujBmTlQF-k,157
|
227
232
|
arpakitlib/_arpakit_project_template_v_5/project/tg_bot/callback/common.py,sha256=FhSQLjdR-XArdorqG9RxsCjgQv_RyWbFZFHM52Sar-4,1023
|
228
|
-
arpakitlib/_arpakit_project_template_v_5/project/tg_bot/const.py,sha256=
|
233
|
+
arpakitlib/_arpakit_project_template_v_5/project/tg_bot/const.py,sha256=tdPNjFQFv5_zcZs_dSVvRs7oXR-xPCaE-165tWzSY9A,1156
|
229
234
|
arpakitlib/_arpakit_project_template_v_5/project/tg_bot/event.py,sha256=9BkUt4qsNUT3_AnTKBUTen0G2-L1872XKriQKS_hIxk,3628
|
230
235
|
arpakitlib/_arpakit_project_template_v_5/project/tg_bot/filter_/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
231
236
|
arpakitlib/_arpakit_project_template_v_5/project/tg_bot/filter_/is_private_chat.py,sha256=2anQo68KqkNYQnfIZDXSOX0P9hU59oSSSIJ36bWQdo8,500
|
@@ -268,25 +273,26 @@ arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/admin/me.py,sha25
|
|
268
273
|
arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/admin/raise_fake_error.py,sha256=UBSrDdf0E6Gss9xWmChVnfCGf7M-hZ2Pq7usSzMz9mU,835
|
269
274
|
arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/admin/reinit_sqlalchemy_db.py,sha256=x2Er6OZd0ymLvyMxqMfPVoSf62QpNh0mPcrYxB2wyGE,1193
|
270
275
|
arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/admin/set_tg_bot_commands.py,sha256=Agdjw1qjcT6l0K-k_AVrgGvLGEY5Jh9fQX66wLwJRVM,981
|
271
|
-
arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/
|
272
|
-
arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/
|
273
|
-
arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/
|
274
|
-
arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/
|
275
|
-
arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/
|
276
|
-
arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/
|
277
|
-
arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/
|
278
|
-
arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/
|
279
|
-
arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/
|
280
|
-
arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/
|
281
|
-
arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/
|
282
|
-
arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/
|
276
|
+
arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/general/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
277
|
+
arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/general/about.py,sha256=R4nAcXU37mwW0WS9Je-Z4NHuYwOUGQWNDQNZOepT5Bg,833
|
278
|
+
arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/general/author.py,sha256=e-K1y5CGJRoPMPgMJEuMi-irQ8Ka_uuNtBFLPibgywU,855
|
279
|
+
arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/general/error_handler.py,sha256=DRPh_kiqXvDkKKWqxpyFDEAnYt6UE9san7ku99GJgzA,3221
|
280
|
+
arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/general/healthcheck.py,sha256=l-M6Oc15o9EQ0M3dTsPcVQIrnVLj5j0adMRUBdnb5r4,529
|
281
|
+
arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/general/hello_world.py,sha256=NjQpD2Q4hUZvqogZOWDWkNo9C9bNWUO6mGEZLJKUW7U,1584
|
282
|
+
arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/general/raw_callback_query.py,sha256=s4jVTZ6k_syYbXdixKnwgj5wHeARP4QD96_sLmBy1vc,792
|
283
|
+
arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/general/raw_inline_query.py,sha256=77LZnmvTtBgIqhJmLV1k_1IUKcm66uW_lLzFV8oi930,289
|
284
|
+
arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/general/raw_message.py,sha256=rdLdF9ML7ezM9V6sy9j67JX-ffpny2nFViBB5thKTa8,413
|
285
|
+
arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/general/remove_message.py,sha256=nYS-Q7ZqVCcHw4oClOzG9w86exbCWcInZc9vF_KfMcw,703
|
286
|
+
arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/general/start.py,sha256=EFAZMbd3CVri_E4gt-B544CSrBBBAsKYVaCslxAfwCs,914
|
287
|
+
arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/general/support.py,sha256=DuJ1QcPuK-rRz8BFErYOaT_Z74NclsvrdmryQL9bmCA,839
|
288
|
+
arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/main_router.py,sha256=nz94jcuZ0rmjGt6NuUXY7bD_cL2SMD0vdjuompd2KK4,2271
|
283
289
|
arpakitlib/_arpakit_project_template_v_5/project/tg_bot/start_tg_bot.py,sha256=vHARWETCD4hlK624aFxnkjsytgEbZY20bt973Oc_Peo,1253
|
284
290
|
arpakitlib/_arpakit_project_template_v_5/project/tg_bot/tg_bot.py,sha256=jMX_awQl3GvyKZ8pmR0dQOzg_2LyrYTmn31DAVmOxxs,849
|
285
291
|
arpakitlib/_arpakit_project_template_v_5/project/tg_bot/tg_bot_dispatcher.py,sha256=CUTYSiVEQrOcOe1pTl8BAHZIDIqurwVQEy0zCmab8Z8,660
|
286
292
|
arpakitlib/_arpakit_project_template_v_5/project/tg_bot/util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
287
293
|
arpakitlib/_arpakit_project_template_v_5/project/tg_bot/util/etc.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
288
294
|
arpakitlib/_arpakit_project_template_v_5/project/tg_bot/util/notify_admins.py,sha256=Qoqa45bbTYCpBhhgSVzN8AH5WBXM0oFnahrCd3XGmTU,1835
|
289
|
-
arpakitlib/_arpakit_project_template_v_5/project/tg_bot/util/set_tg_bot_commands.py,sha256=
|
295
|
+
arpakitlib/_arpakit_project_template_v_5/project/tg_bot/util/set_tg_bot_commands.py,sha256=moTtG-8uSyUx_zxiQi55xQ7Cl2cHiyqtGUAuQ8_g-BI,3470
|
290
296
|
arpakitlib/_arpakit_project_template_v_5/project/util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
291
297
|
arpakitlib/_arpakit_project_template_v_5/project/util/arpakitlib_project_template.py,sha256=syA_IuszHVub0zm0sVdB4_7rPJXwXRW4JmQ4qHbjXPk,396
|
292
298
|
arpakitlib/ar_additional_model_util.py,sha256=GFg-glLCxH9X95R2bhTJsscVwv37FgE1qbaAAyXrnIE,917
|
@@ -340,8 +346,8 @@ arpakitlib/ar_type_util.py,sha256=Cs_tef-Fc5xeyAF54KgISCsP11NHyzIsglm4S3Xx7iM,40
|
|
340
346
|
arpakitlib/ar_wata_api_client.py,sha256=gdHOqDbuqxhTjVDtRW1DvkRJLdDofCrOq51GTctzLns,242
|
341
347
|
arpakitlib/ar_yookassa_api_client_util.py,sha256=VozuZeCJjmLd1zj2BdC9WfiAQ3XYOrIMsdpNK-AUlm0,5347
|
342
348
|
arpakitlib/ar_zabbix_api_client_util.py,sha256=Q-VR4MvoZ9aHwZeYZr9G3LwN-ANx1T5KFmF6pvPM-9M,6402
|
343
|
-
arpakitlib-1.8.
|
344
|
-
arpakitlib-1.8.
|
345
|
-
arpakitlib-1.8.
|
346
|
-
arpakitlib-1.8.
|
347
|
-
arpakitlib-1.8.
|
349
|
+
arpakitlib-1.8.21.dist-info/LICENSE,sha256=GPEDQMam2r7FSTYqM1mm7aKnxLaWcBotH7UvQtea-ec,11355
|
350
|
+
arpakitlib-1.8.21.dist-info/METADATA,sha256=qKkcrxSptiTet5lmpfdIMRsYHhI9ZXC5OEEYSESBnX4,3432
|
351
|
+
arpakitlib-1.8.21.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
|
352
|
+
arpakitlib-1.8.21.dist-info/entry_points.txt,sha256=36xqR3PJFT2kuwjkM_EqoIy0qFUDPKSm_mJaI7emewE,87
|
353
|
+
arpakitlib-1.8.21.dist-info/RECORD,,
|
@@ -1,218 +0,0 @@
|
|
1
|
-
from typing import Callable
|
2
|
-
|
3
|
-
import fastapi
|
4
|
-
import fastapi.exceptions
|
5
|
-
import fastapi.responses
|
6
|
-
import fastapi.security
|
7
|
-
import sqlalchemy
|
8
|
-
from fastapi import Security
|
9
|
-
from fastapi.security import APIKeyHeader
|
10
|
-
from pydantic import BaseModel, ConfigDict
|
11
|
-
|
12
|
-
from arpakitlib.ar_func_util import is_async_func, is_sync_func
|
13
|
-
from arpakitlib.ar_json_util import transfer_data_to_json_str_to_data
|
14
|
-
from project.api.const import APIErrorCodes
|
15
|
-
from project.api.exception import APIException
|
16
|
-
from project.core.settings import get_cached_settings
|
17
|
-
from project.sqlalchemy_db_.sqlalchemy_db import get_cached_sqlalchemy_db
|
18
|
-
from project.sqlalchemy_db_.sqlalchemy_model import ApiKeyDBM, UserTokenDBM
|
19
|
-
|
20
|
-
|
21
|
-
class APIAuthData(BaseModel):
|
22
|
-
model_config = ConfigDict(extra="forbid", arbitrary_types_allowed=True, from_attributes=True)
|
23
|
-
|
24
|
-
api_key_string: str | None = None
|
25
|
-
user_token_string: str | None = None
|
26
|
-
|
27
|
-
api_key_dbm: ApiKeyDBM | None = None
|
28
|
-
user_token_dbm: UserTokenDBM | None = None
|
29
|
-
|
30
|
-
prod_mode: bool = False
|
31
|
-
|
32
|
-
|
33
|
-
def api_auth(
|
34
|
-
*,
|
35
|
-
middlewares: list[Callable] | None = None
|
36
|
-
) -> Callable:
|
37
|
-
if middlewares is None:
|
38
|
-
middlewares = []
|
39
|
-
|
40
|
-
async def async_func(
|
41
|
-
*,
|
42
|
-
ac: fastapi.security.HTTPAuthorizationCredentials | None = fastapi.Security(
|
43
|
-
fastapi.security.HTTPBearer(auto_error=False)
|
44
|
-
),
|
45
|
-
api_key_string: str | None = Security(
|
46
|
-
APIKeyHeader(name="apikey", auto_error=False)
|
47
|
-
),
|
48
|
-
request: fastapi.requests.Request
|
49
|
-
) -> APIAuthData:
|
50
|
-
|
51
|
-
api_auth_data = APIAuthData(
|
52
|
-
prod_mode=get_cached_settings().prod_mode
|
53
|
-
)
|
54
|
-
|
55
|
-
# parse api_key_string
|
56
|
-
|
57
|
-
api_auth_data.api_key_string = api_key_string
|
58
|
-
|
59
|
-
if not api_auth_data.api_key_string and "api_key" in request.headers.keys():
|
60
|
-
api_auth_data.api_key_string = request.headers["api_key"]
|
61
|
-
if not api_auth_data.api_key_string and "api-key" in request.headers.keys():
|
62
|
-
api_auth_data.api_key_string = request.headers["api-key"]
|
63
|
-
if not api_auth_data.api_key_string and "apikey" in request.headers.keys():
|
64
|
-
api_auth_data.api_key_string = request.headers["apikey"]
|
65
|
-
if not api_auth_data.api_key_string and "api_key_string" in request.headers.keys():
|
66
|
-
api_auth_data.api_key_string = request.headers["api_key_string"]
|
67
|
-
|
68
|
-
if not api_auth_data.api_key_string and "api_key" in request.query_params.keys():
|
69
|
-
api_auth_data.api_key_string = request.query_params["api_key"]
|
70
|
-
if not api_auth_data.api_key_string and "api-key" in request.query_params.keys():
|
71
|
-
api_auth_data.api_key_string = request.query_params["api-key"]
|
72
|
-
if not api_auth_data.api_key_string and "apikey" in request.query_params.keys():
|
73
|
-
api_auth_data.api_key_string = request.query_params["apikey"]
|
74
|
-
if not api_auth_data.api_key_string and "api_key_string" in request.query_params.keys():
|
75
|
-
api_auth_data.api_key_string = request.query_params["api_key_string"]
|
76
|
-
|
77
|
-
if api_auth_data.api_key_string:
|
78
|
-
api_auth_data.api_key_string = api_auth_data.api_key_string.strip()
|
79
|
-
if not api_auth_data.api_key_string:
|
80
|
-
api_auth_data.api_key_string = None
|
81
|
-
|
82
|
-
# parse user_token_string
|
83
|
-
|
84
|
-
api_auth_data.user_token_string = ac.credentials if ac and ac.credentials and ac.credentials.strip() else None
|
85
|
-
|
86
|
-
if not api_auth_data.user_token_string and "token" in request.headers.keys():
|
87
|
-
api_auth_data.user_token_string = request.headers["token"]
|
88
|
-
|
89
|
-
if not api_auth_data.user_token_string and "user_token" in request.headers.keys():
|
90
|
-
api_auth_data.user_token_string = request.headers["user_token"]
|
91
|
-
if not api_auth_data.user_token_string and "user-token" in request.headers.keys():
|
92
|
-
api_auth_data.user_token_string = request.headers["user-token"]
|
93
|
-
if not api_auth_data.user_token_string and "usertoken" in request.headers.keys():
|
94
|
-
api_auth_data.user_token_string = request.headers["usertoken"]
|
95
|
-
|
96
|
-
if not api_auth_data.user_token_string and "token" in request.query_params.keys():
|
97
|
-
api_auth_data.user_token_string = request.query_params["token"]
|
98
|
-
|
99
|
-
if not api_auth_data.user_token_string and "user_token" in request.query_params.keys():
|
100
|
-
api_auth_data.user_token_string = request.query_params["user_token"]
|
101
|
-
if not api_auth_data.user_token_string and "user-token" in request.query_params.keys():
|
102
|
-
api_auth_data.user_token_string = request.query_params["user-token"]
|
103
|
-
if not api_auth_data.user_token_string and "usertoken" in request.query_params.keys():
|
104
|
-
api_auth_data.user_token_string = request.query_params["usertoken"]
|
105
|
-
|
106
|
-
if api_auth_data.user_token_string:
|
107
|
-
api_auth_data.user_token_string = api_auth_data.user_token_string.strip()
|
108
|
-
if not api_auth_data.user_token_string:
|
109
|
-
api_auth_data.user_token_string = None
|
110
|
-
|
111
|
-
# middlewares
|
112
|
-
|
113
|
-
for middleware in middlewares:
|
114
|
-
if is_async_func(middleware):
|
115
|
-
await middleware(
|
116
|
-
api_auth_data=api_auth_data,
|
117
|
-
request=request
|
118
|
-
)
|
119
|
-
elif is_sync_func(middleware):
|
120
|
-
middleware(
|
121
|
-
api_auth_data=api_auth_data,
|
122
|
-
request=request
|
123
|
-
)
|
124
|
-
else:
|
125
|
-
raise TypeError(f"unknown middleware type, {middleware.__name__}")
|
126
|
-
|
127
|
-
return api_auth_data
|
128
|
-
|
129
|
-
return async_func
|
130
|
-
|
131
|
-
|
132
|
-
def require_prod_mode_api_middleware():
|
133
|
-
def func(*, api_auth_data: APIAuthData, request: fastapi.requests.Request):
|
134
|
-
if not get_cached_settings().prod_mode:
|
135
|
-
raise APIException(
|
136
|
-
status_code=fastapi.status.HTTP_401_UNAUTHORIZED,
|
137
|
-
error_code=APIErrorCodes.cannot_authorize,
|
138
|
-
error_description=f"prod_mode={get_cached_settings().prod_mode}",
|
139
|
-
error_data=transfer_data_to_json_str_to_data(api_auth_data.model_dump())
|
140
|
-
)
|
141
|
-
|
142
|
-
return func
|
143
|
-
|
144
|
-
|
145
|
-
def require_not_prod_mode_api_middleware():
|
146
|
-
def func(*, api_auth_data: APIAuthData, request: fastapi.requests.Request):
|
147
|
-
if get_cached_settings().prod_mode:
|
148
|
-
raise APIException(
|
149
|
-
status_code=fastapi.status.HTTP_401_UNAUTHORIZED,
|
150
|
-
error_code=APIErrorCodes.cannot_authorize,
|
151
|
-
error_description=f"prod_mode={get_cached_settings().prod_mode}",
|
152
|
-
error_data=transfer_data_to_json_str_to_data(api_auth_data.model_dump())
|
153
|
-
)
|
154
|
-
|
155
|
-
return func
|
156
|
-
|
157
|
-
|
158
|
-
def require_api_key_string_api_middleware():
|
159
|
-
def func(*, api_auth_data: APIAuthData, request: fastapi.requests.Request):
|
160
|
-
if api_auth_data.api_key_string is None:
|
161
|
-
raise APIException(
|
162
|
-
status_code=fastapi.status.HTTP_401_UNAUTHORIZED,
|
163
|
-
error_code=APIErrorCodes.cannot_authorize,
|
164
|
-
error_description="api_key_string is required",
|
165
|
-
error_data=transfer_data_to_json_str_to_data(api_auth_data.model_dump())
|
166
|
-
)
|
167
|
-
|
168
|
-
return func
|
169
|
-
|
170
|
-
|
171
|
-
def require_user_token_string_api_middleware():
|
172
|
-
def func(*, api_auth_data: APIAuthData, request: fastapi.requests.Request):
|
173
|
-
if api_auth_data.user_token_string is None:
|
174
|
-
raise APIException(
|
175
|
-
status_code=fastapi.status.HTTP_401_UNAUTHORIZED,
|
176
|
-
error_code=APIErrorCodes.cannot_authorize,
|
177
|
-
error_description="user_token_string is required",
|
178
|
-
error_data=transfer_data_to_json_str_to_data(api_auth_data.model_dump())
|
179
|
-
)
|
180
|
-
|
181
|
-
return func
|
182
|
-
|
183
|
-
|
184
|
-
def try_find_api_key_dbm_api_middleware():
|
185
|
-
async def async_func(*, api_auth_data: APIAuthData, request: fastapi.requests.Request):
|
186
|
-
if api_auth_data.api_key_dbm is None:
|
187
|
-
return
|
188
|
-
async with get_cached_sqlalchemy_db().new_async_session() as async_session:
|
189
|
-
api_auth_data.api_key_dbm = await async_session.scalar(
|
190
|
-
sqlalchemy.select(ApiKeyDBM).where(ApiKeyDBM.value == api_auth_data.api_key_string)
|
191
|
-
)
|
192
|
-
|
193
|
-
return async_func
|
194
|
-
|
195
|
-
|
196
|
-
def try_find_user_token_dbm_api_middleware():
|
197
|
-
async def async_func(*, api_auth_data: APIAuthData, request: fastapi.requests.Request):
|
198
|
-
if api_auth_data.user_token_dbm is None:
|
199
|
-
return
|
200
|
-
async with get_cached_sqlalchemy_db().new_async_session() as async_session:
|
201
|
-
api_auth_data.user_token_dbm = await async_session.scalar(
|
202
|
-
sqlalchemy.select(UserTokenDBM).where(UserTokenDBM.value == api_auth_data.user_token_string)
|
203
|
-
)
|
204
|
-
|
205
|
-
return async_func
|
206
|
-
|
207
|
-
|
208
|
-
def require_api_key_dbm_api_middleware():
|
209
|
-
async def async_func(*, api_auth_data: APIAuthData, request: fastapi.requests.Request):
|
210
|
-
if api_auth_data.api_key_dbm is None:
|
211
|
-
raise APIException(
|
212
|
-
status_code=fastapi.status.HTTP_401_UNAUTHORIZED,
|
213
|
-
error_code=APIErrorCodes.cannot_authorize,
|
214
|
-
error_description="api_key_dbm is required",
|
215
|
-
error_data=transfer_data_to_json_str_to_data(api_auth_data.model_dump())
|
216
|
-
)
|
217
|
-
|
218
|
-
return async_func
|
@@ -1,14 +0,0 @@
|
|
1
|
-
from __future__ import annotations
|
2
|
-
|
3
|
-
from project.api.schema.out.admin.common import SimpleDBMAdminSO
|
4
|
-
from project.sqlalchemy_db_.sqlalchemy_model import UserTokenDBM
|
5
|
-
|
6
|
-
|
7
|
-
class UserTokenDBMSAdminSO(SimpleDBMAdminSO):
|
8
|
-
value: str
|
9
|
-
user_id: int
|
10
|
-
is_enabled: bool
|
11
|
-
|
12
|
-
@classmethod
|
13
|
-
def from_user_token_dbm(cls, *, user_dbm: UserTokenDBM) -> UserTokenDBMSAdminSO:
|
14
|
-
return cls.model_validate(user_dbm.simple_dict_with_sd_properties())
|
/arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/{client → general}/__init__.py
RENAMED
File without changes
|
/arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/{client → general}/error_handler.py
RENAMED
File without changes
|
/arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/{client → general}/healthcheck.py
RENAMED
File without changes
|
/arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/{client → general}/hello_world.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
/arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/{client → general}/raw_message.py
RENAMED
File without changes
|
/arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/{client → general}/remove_message.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|