arpakitlib 1.8.18__py3-none-any.whl → 1.8.20__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 +3 -0
- arpakitlib/_arpakit_project_template_v_5/command/alembic_revision_autogenerate.sh +2 -0
- arpakitlib/_arpakit_project_template_v_5/command/reinit_all_sqlalchemy_db.py +13 -0
- arpakitlib/{_arpakit_project_template_v_4/project/api/auth2.py → _arpakit_project_template_v_5/project/api/auth.py} +133 -26
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/exception_handler.py +11 -12
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/router/admin/get_arpakitlib_project_template_info.py +9 -3
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/router/admin/get_auth_data.py +7 -9
- arpakitlib/_arpakit_project_template_v_5/project/api/router/admin/main_router.py +20 -0
- arpakitlib/_arpakit_project_template_v_5/project/api/router/admin/raise_fake_error.py +27 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/router/client/get_errors_info.py +8 -2
- arpakitlib/_arpakit_project_template_v_5/project/api/router/client/main_router.py +10 -0
- arpakitlib/_arpakit_project_template_v_5/project/api/router/general/main_router.py +14 -0
- arpakitlib/{_arpakit_project_template_v_4/project/api/router/client → _arpakit_project_template_v_5/project/api/router/general}/now_utc_datetime.py +3 -3
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/schema/out/admin/common.py +1 -1
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/schema/out/admin/operation.py +2 -2
- arpakitlib/{_arpakit_project_template_v_4 → _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/admin/user.py +22 -0
- arpakitlib/_arpakit_project_template_v_5/project/api/schema/out/admin/user_token.py +14 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/schema/out/client/common.py +1 -1
- arpakitlib/{_arpakit_project_template_v_4/project/api/schema/out/general → _arpakit_project_template_v_5/project/api/schema/out/common}/error.py +1 -1
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/core/settings.py +3 -17
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/operation_execution/operation_executor_worker.py +2 -2
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/sandbox/sandbox_1.py +3 -1
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/sqlalchemy_db_/sqlalchemy_model/api_key.py +1 -1
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/sqlalchemy_db_/sqlalchemy_model/user.py +2 -2
- arpakitlib/{_arpakit_project_template_v_4 → _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_4 → _arpakit_project_template_v_5}/project/test_data/make_test_data_1.py +4 -2
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/test_data/make_test_data_2.py +4 -2
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/test_data/make_test_data_3.py +4 -2
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/test_data/make_test_data_4.py +4 -2
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/test_data/make_test_data_5.py +4 -2
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/tg_bot/blank/admin.py +2 -8
- arpakitlib/_arpakit_project_template_v_5/project/tg_bot/blank/client.py +69 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/tg_bot/callback/client.py +4 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/tg_bot/const.py +7 -6
- arpakitlib/_arpakit_project_template_v_5/project/tg_bot/filter_/user_roles_has_admin.py +18 -0
- arpakitlib/_arpakit_project_template_v_5/project/tg_bot/filter_/user_roles_has_client.py +18 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/tg_bot/middleware/init_user.py +9 -8
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/tg_bot/router/admin/arpakitlib_project_template_info.py +6 -4
- arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/admin/clear_log_file.py +33 -0
- arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/admin/drop_sqlalchemy_db.py +31 -0
- arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/admin/init_sqlalchemy_db.py +28 -0
- arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/admin/kb_with_not_modified.py +59 -0
- arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/admin/kb_with_old_cd.py +40 -0
- arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/admin/kb_with_raise_error.py +48 -0
- arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/admin/kb_with_remove_message.py +35 -0
- arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/admin/log_file.py +37 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/tg_bot/router/admin/me.py +4 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/tg_bot/router/admin/raise_fake_error.py +5 -1
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/tg_bot/router/admin/reinit_sqlalchemy_db.py +7 -3
- arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/admin/set_tg_bot_commands.py +28 -0
- arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/client/about.py +30 -0
- arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/client/error_handler.py +91 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/tg_bot/router/client/healthcheck.py +3 -1
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/tg_bot/router/client/hello_world.py +5 -2
- arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/client/raw_callback_query.py +30 -0
- arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/client/raw_inline_query.py +14 -0
- arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/client/raw_message.py +15 -0
- arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/client/remove_message.py +28 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/tg_bot/router/client/start.py +3 -2
- arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/client/support.py +30 -0
- arpakitlib/_arpakit_project_template_v_5/project/tg_bot/router/main_router.py +36 -0
- arpakitlib/_arpakit_project_template_v_5/project/tg_bot/util/notify_admins.py +58 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/tg_bot/util/set_tg_bot_commands.py +26 -4
- arpakitlib/_arpakit_project_template_v_5/project/util/__init__.py +0 -0
- arpakitlib/ar_base_worker_util.py +7 -7
- arpakitlib/ar_blank_util.py +2 -2
- arpakitlib/ar_func_util.py +21 -14
- arpakitlib/ar_sqlalchemy_util.py +9 -3
- {arpakitlib-1.8.18.dist-info → arpakitlib-1.8.20.dist-info}/METADATA +1 -1
- arpakitlib-1.8.20.dist-info/RECORD +348 -0
- arpakitlib/_arpakit_project_template_v_4/arpakitlib_project_template_info.json +0 -3
- arpakitlib/_arpakit_project_template_v_4/command/alembic_revision_autogenerate.sh +0 -2
- arpakitlib/_arpakit_project_template_v_4/project/api/auth.py +0 -353
- arpakitlib/_arpakit_project_template_v_4/project/api/router/admin/main_router.py +0 -3
- arpakitlib/_arpakit_project_template_v_4/project/api/router/client/main_router.py +0 -3
- arpakitlib/_arpakit_project_template_v_4/project/api/router/general/main_router.py +0 -10
- arpakitlib/_arpakit_project_template_v_4/project/api/schema/out/common.py +0 -5
- arpakitlib/_arpakit_project_template_v_4/project/tg_bot/blank/client.py +0 -44
- arpakitlib/_arpakit_project_template_v_4/project/tg_bot/error_handler.py +0 -37
- arpakitlib/_arpakit_project_template_v_4/project/tg_bot/filter_/user_roles_has_admin.py +0 -27
- arpakitlib/_arpakit_project_template_v_4/project/tg_bot/filter_/user_roles_has_client.py +0 -27
- arpakitlib/_arpakit_project_template_v_4/project/tg_bot/router/admin/main_router.py +0 -15
- arpakitlib/_arpakit_project_template_v_4/project/tg_bot/router/client/main_router.py +0 -14
- arpakitlib/_arpakit_project_template_v_4/project/tg_bot/router/main_router.py +0 -13
- arpakitlib-1.8.18.dist-info/RECORD +0 -330
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/.gitignore +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/.python-version +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/LICENSE +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/README.md +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/alembic/README +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/alembic/env.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/alembic/script.py.mako +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/alembic/versions/__init__.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/alembic.ini +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/__init__.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/alembic_history.sh +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/alembic_upgrade_head.sh +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/beautify_json.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/check_logging.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/check_sqlalchemy_db.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/demojize.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/docker_ps_a.sh +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/docker_rm_postgres.sh +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/docker_run_postgres.sh +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/docker_start_postgres.sh +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/docker_stop_postgres.sh +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/drop_json_db.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/drop_sqlalchemy_db.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/generate_settings_env_example.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/git_commit.sh +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/git_push_arpakit_company_github_1.sh +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/git_push_arpakit_company_gitlab_1.sh +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/git_push_arpakit_github_1.sh +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/git_push_arpakit_gitlab_1.sh +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/git_remote_v.sh +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/git_set_arpakit_company_origin.sh +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/git_set_arpakit_origin.sh +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/git_set_divarteam_origin.sh +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/git_status.sh +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/hello_world.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/init_json_db.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/init_sqlalchemy_db.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/poetry_check.sh +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/poetry_clear_cache.sh +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/poetry_config.sh +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/poetry_install.sh +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/poetry_lock.sh +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/poetry_remove_and_add_arpakitlib.sh +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/poetry_show.sh +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/poetry_show_arpakitlib.sh +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/poetry_update.sh +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/poetry_update_arpakitlib.sh +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/reinit_json_db.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/reinit_sqlalchemy_db.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/remove_operations.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/remove_story_logs.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/rm_all_records_in_json_db.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/set_tg_bot_commands.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/show_settings.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/start_api.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/start_api_for_prod.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/start_api_with_reload.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/start_operation_executor_worker.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/start_operation_executor_workers.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/start_scheduled_operation_creator_worker.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/start_sqladmin.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/start_sqladmin_for_prod.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/start_sqladmin_with_reload.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/start_tg_bot.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/command/start_tg_bot_for_prod.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/example.env +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/note/note_1.txt +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/note/note_2.txt +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/note/note_3.txt +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/note/note_4.txt +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/note/note_5.txt +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/__init__.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/additional_model/__init__.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/additional_model/common.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/__init__.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/asgi.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/const.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/create_api_app.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/event.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/exception.py +1 -1
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/openapi_ui.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/response.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/router/__init__.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/router/admin/__init__.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/router/client/__init__.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/router/general/__init__.py +0 -0
- arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/router/general/healthcheck.py +1 -1
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/router/main_router.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/schema/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/schema/common.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/schema/in_/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/schema/in_/admin/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/schema/in_/admin/common.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/schema/in_/client/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/schema/in_/client/common.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4/project/api/schema/in_/general → _arpakit_project_template_v_5/project/api/schema/in_/common}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4/project/api/schema/out → _arpakit_project_template_v_5/project/api/schema/in_/general}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/schema/in_/general/common.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4/project/api/schema/out/admin → _arpakit_project_template_v_5/project/api/schema/out}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4/project/api/schema/out/client → _arpakit_project_template_v_5/project/api/schema/out/admin}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4/project/api/schema/out/common → _arpakit_project_template_v_5/project/api/schema/out/client}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4/project/api/schema/out/general → _arpakit_project_template_v_5/project/api/schema/out/common}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/schema/out/common/datetime_.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/schema/out/common/raw_data.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4/project/business_service → _arpakit_project_template_v_5/project/api/schema/out/general}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/schema/out/general/common.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/schema/out/general/errors_info_general.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/schema/out/general/healthcheck.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/api/util.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4/project/celery_ → _arpakit_project_template_v_5/project/business_service}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/business_service/hello_world.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/business_service/remove_operations.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4/project/core → _arpakit_project_template_v_5/project/celery_}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4/project/json_db → _arpakit_project_template_v_5/project/core}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/core/cache_file_storage_in_dir.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/core/const.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/core/dump_file_storage_in_dir.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/core/jinja2_templates.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/core/media_file_storage_in_dir.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/core/util.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4/project/operation_execution → _arpakit_project_template_v_5/project/json_db}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/json_db/json_db.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/more/helloworld +0 -0
- /arpakitlib/{_arpakit_project_template_v_4/project/resource → _arpakit_project_template_v_5/project/operation_execution}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/operation_execution/const.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/operation_execution/scheduled_operation_creator_worker.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/operation_execution/scheduled_operations.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/operation_execution/util.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4/project/sandbox → _arpakit_project_template_v_5/project/resource}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/resource/static/1 +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/resource/static/healthcheck +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/resource/static/helloworld +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/resource/static/openapi-favicon.png +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/resource/static/redoc/redoc.standalone.js +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/resource/static/swagger-ui/favicon-16x16.png +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/resource/static/swagger-ui/favicon-32x32.png +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/resource/static/swagger-ui/index.css +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/resource/static/swagger-ui/index.html +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/resource/static/swagger-ui/oauth2-redirect.html +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/resource/static/swagger-ui/swagger-initializer.js +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/resource/static/swagger-ui/swagger-ui-bundle.js +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/resource/static/swagger-ui/swagger-ui-bundle.js.map +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/resource/static/swagger-ui/swagger-ui-es-bundle-core.js +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/resource/static/swagger-ui/swagger-ui-es-bundle-core.js.map +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/resource/static/swagger-ui/swagger-ui-es-bundle.js +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/resource/static/swagger-ui/swagger-ui-es-bundle.js.map +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/resource/static/swagger-ui/swagger-ui-standalone-preset.js +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/resource/static/swagger-ui/swagger-ui-standalone-preset.js.map +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/resource/static/swagger-ui/swagger-ui.css +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/resource/static/swagger-ui/swagger-ui.css.map +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/resource/static/swagger-ui/swagger-ui.js +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/resource/static/swagger-ui/swagger-ui.js.map +0 -0
- /arpakitlib/{_arpakit_project_template_v_4/project/site → _arpakit_project_template_v_5/project/sandbox}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/sandbox/sandbox_2.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/sandbox/sandbox_3.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/sandbox/sandbox_4.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/sandbox/sandbox_5.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/sandbox/sandbox_6.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/sandbox/sandbox_7.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4/project/site/router → _arpakit_project_template_v_5/project/site}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/site/asgi.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/site/consts.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/site/create_site_app.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/site/event.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/site/exception_handler.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4/project/sqladmin_ → _arpakit_project_template_v_5/project/site/router}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/site/router/main_router.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4/project/sqlalchemy_db_ → _arpakit_project_template_v_5/project/sqladmin_}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/sqladmin_/add_admin_in_app.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/sqladmin_/admin_auth.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/sqladmin_/asgi.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/sqladmin_/create_sqladmin_app.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/sqladmin_/event.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/sqladmin_/model_view/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/sqladmin_/model_view/common.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/sqladmin_/model_view/operation.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/sqladmin_/model_view/story_log.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4/project/test_data → _arpakit_project_template_v_5/project/sqlalchemy_db_}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/sqlalchemy_db_/const.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/sqlalchemy_db_/sqlalchemy_db.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/sqlalchemy_db_/sqlalchemy_model/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/sqlalchemy_db_/sqlalchemy_model/common.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/sqlalchemy_db_/sqlalchemy_model/operation.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/sqlalchemy_db_/sqlalchemy_model/story_log.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/sqlalchemy_db_/util.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4/project/tg_bot → _arpakit_project_template_v_5/project/test_data}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4/project/tg_bot/blank → _arpakit_project_template_v_5/project/tg_bot}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4/project/tg_bot/callback → _arpakit_project_template_v_5/project/tg_bot/blank}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/tg_bot/blank/common.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4/project/tg_bot/filter_ → _arpakit_project_template_v_5/project/tg_bot/callback}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/tg_bot/callback/admin.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/tg_bot/callback/common.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/tg_bot/event.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4/project/tg_bot/kb → _arpakit_project_template_v_5/project/tg_bot/filter_}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/tg_bot/filter_/is_private_chat.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/tg_bot/filter_/message_text.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/tg_bot/filter_/not_prod_mode_filter.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/tg_bot/filter_/prod_mode_filter.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4/project/tg_bot/kb/inline_ → _arpakit_project_template_v_5/project/tg_bot/kb}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4/project/tg_bot/kb/inline_/admin → _arpakit_project_template_v_5/project/tg_bot/kb/inline_}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4/project/tg_bot/kb/inline_/client → _arpakit_project_template_v_5/project/tg_bot/kb/inline_/admin}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/tg_bot/kb/inline_/admin/common.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4/project/tg_bot/kb/static_ → _arpakit_project_template_v_5/project/tg_bot/kb/inline_/client}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/tg_bot/kb/inline_/client/common.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/tg_bot/kb/inline_/client/hello_world.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/tg_bot/kb/inline_/common.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4/project/tg_bot/kb/static_/admin → _arpakit_project_template_v_5/project/tg_bot/kb/static_}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4/project/tg_bot/kb/static_/client → _arpakit_project_template_v_5/project/tg_bot/kb/static_/admin}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/tg_bot/kb/static_/admin/common.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4/project/tg_bot/middleware → _arpakit_project_template_v_5/project/tg_bot/kb/static_/client}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/tg_bot/kb/static_/client/common.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/tg_bot/kb/static_/client/hello_world.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/tg_bot/kb/static_/common.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4/project/tg_bot/router → _arpakit_project_template_v_5/project/tg_bot/middleware}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/tg_bot/middleware/common.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/tg_bot/middleware/middleware.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4/project/tg_bot/router/admin → _arpakit_project_template_v_5/project/tg_bot/router}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4/project/tg_bot/router/client → _arpakit_project_template_v_5/project/tg_bot/router/admin}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4/project/tg_bot/util → _arpakit_project_template_v_5/project/tg_bot/router/client}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/tg_bot/start_tg_bot.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/tg_bot/tg_bot.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/tg_bot/tg_bot_dispatcher.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4/project → _arpakit_project_template_v_5/project/tg_bot}/util/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/tg_bot/util/etc.py +0 -0
- /arpakitlib/{_arpakit_project_template_v_4 → _arpakit_project_template_v_5}/project/util/arpakitlib_project_template.py +0 -0
- {arpakitlib-1.8.18.dist-info → arpakitlib-1.8.20.dist-info}/LICENSE +0 -0
- {arpakitlib-1.8.18.dist-info → arpakitlib-1.8.20.dist-info}/WHEEL +0 -0
- {arpakitlib-1.8.18.dist-info → arpakitlib-1.8.20.dist-info}/entry_points.txt +0 -0
@@ -1,353 +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_callable, is_sync_function
|
13
|
-
from arpakitlib.ar_json_util import transfer_data_to_json_str_to_data
|
14
|
-
from arpakitlib.ar_type_util import raise_for_type
|
15
|
-
from project.api.const import APIErrorCodes
|
16
|
-
from project.api.exception import APIException
|
17
|
-
from project.core.settings import get_cached_settings
|
18
|
-
from project.sqlalchemy_db_.sqlalchemy_db import get_cached_sqlalchemy_db
|
19
|
-
from project.sqlalchemy_db_.sqlalchemy_model import ApiKeyDBM, UserTokenDBM
|
20
|
-
|
21
|
-
|
22
|
-
class APIAuthData(BaseModel):
|
23
|
-
model_config = ConfigDict(extra="forbid", arbitrary_types_allowed=True, from_attributes=True)
|
24
|
-
|
25
|
-
require_api_key_string: bool = False
|
26
|
-
require_user_token_string: bool = False
|
27
|
-
|
28
|
-
require_correct_api_key: bool = False
|
29
|
-
require_correct_user_token: bool = False
|
30
|
-
|
31
|
-
require_mode_type: str | None = None
|
32
|
-
require_not_mode_type: str | None = None
|
33
|
-
|
34
|
-
current_mode_type: str | None = None
|
35
|
-
|
36
|
-
api_key_string: str | None = None
|
37
|
-
user_token_string: str | None = None
|
38
|
-
|
39
|
-
is_api_key_correct: bool | None = None
|
40
|
-
is_user_token_correct: bool | None = None
|
41
|
-
|
42
|
-
api_key_dbm: ApiKeyDBM | None = None
|
43
|
-
user_token_dbm: UserTokenDBM | None = None
|
44
|
-
|
45
|
-
|
46
|
-
def api_auth(
|
47
|
-
*,
|
48
|
-
require_api_key_string: bool = False,
|
49
|
-
require_user_token_string: bool = False,
|
50
|
-
|
51
|
-
require_correct_api_key: bool = False,
|
52
|
-
require_correct_user_token: bool = False,
|
53
|
-
|
54
|
-
require_mode_type: str | None = None,
|
55
|
-
require_not_mode_type: str | None = None,
|
56
|
-
|
57
|
-
is_api_key_correct_func: Callable | None = None,
|
58
|
-
is_user_token_correct_func: Callable | None = None,
|
59
|
-
correct_api_keys: str | list[str] | None = None,
|
60
|
-
correct_user_tokens: str | list[str] | None = None,
|
61
|
-
) -> Callable:
|
62
|
-
if isinstance(correct_api_keys, str):
|
63
|
-
correct_api_keys = [correct_api_keys]
|
64
|
-
if correct_api_keys is not None:
|
65
|
-
raise_for_type(correct_api_keys, list)
|
66
|
-
|
67
|
-
if is_api_key_correct_func is None and correct_api_keys is not None:
|
68
|
-
is_api_key_correct_func = (
|
69
|
-
lambda *args, **kwargs_: kwargs_["api_auth_data"].api_key_string in correct_api_keys
|
70
|
-
)
|
71
|
-
|
72
|
-
if isinstance(correct_user_tokens, str):
|
73
|
-
correct_user_tokens = [correct_user_tokens]
|
74
|
-
if correct_user_tokens is not None:
|
75
|
-
raise_for_type(correct_user_tokens, list)
|
76
|
-
|
77
|
-
if is_user_token_correct_func is None and correct_user_tokens is not None:
|
78
|
-
is_user_token_correct_func = (
|
79
|
-
lambda *args, **kwargs_: kwargs_["api_auth_data"].user_token_string in correct_user_tokens
|
80
|
-
)
|
81
|
-
|
82
|
-
if require_correct_api_key is True:
|
83
|
-
require_api_key_string = True
|
84
|
-
|
85
|
-
if require_correct_user_token is True:
|
86
|
-
require_user_token_string = True
|
87
|
-
|
88
|
-
async def func(
|
89
|
-
*,
|
90
|
-
ac: fastapi.security.HTTPAuthorizationCredentials | None = fastapi.Security(
|
91
|
-
fastapi.security.HTTPBearer(auto_error=False)
|
92
|
-
),
|
93
|
-
api_key_string: str | None = Security(
|
94
|
-
APIKeyHeader(name="apikey", auto_error=False)
|
95
|
-
),
|
96
|
-
request: fastapi.requests.Request
|
97
|
-
) -> APIAuthData:
|
98
|
-
|
99
|
-
api_auth_data = APIAuthData(
|
100
|
-
require_api_key_string=require_api_key_string,
|
101
|
-
require_user_token_string=require_user_token_string,
|
102
|
-
require_correct_api_key=require_correct_api_key,
|
103
|
-
require_correct_user_token=require_correct_user_token,
|
104
|
-
require_mode_type=require_mode_type,
|
105
|
-
require_not_mode_type=require_not_mode_type,
|
106
|
-
current_mode_type=get_cached_settings().mode_type
|
107
|
-
)
|
108
|
-
|
109
|
-
# parse api_key
|
110
|
-
|
111
|
-
api_auth_data.api_key_string = api_key_string
|
112
|
-
|
113
|
-
if not api_auth_data.api_key_string and "api_key" in request.headers.keys():
|
114
|
-
api_auth_data.api_key_string = request.headers["api_key"]
|
115
|
-
if not api_auth_data.api_key_string and "api-key" in request.headers.keys():
|
116
|
-
api_auth_data.api_key_string = request.headers["api-key"]
|
117
|
-
if not api_auth_data.api_key_string and "apikey" in request.headers.keys():
|
118
|
-
api_auth_data.api_key_string = request.headers["apikey"]
|
119
|
-
|
120
|
-
if not api_auth_data.api_key_string and "api_key" in request.query_params.keys():
|
121
|
-
api_auth_data.api_key_string = request.query_params["api_key"]
|
122
|
-
if not api_auth_data.api_key_string and "api-key" in request.query_params.keys():
|
123
|
-
api_auth_data.api_key_string = request.query_params["api-key"]
|
124
|
-
if not api_auth_data.api_key_string and "apikey" in request.query_params.keys():
|
125
|
-
api_auth_data.api_key_string = request.query_params["apikey"]
|
126
|
-
|
127
|
-
if api_auth_data.api_key_string:
|
128
|
-
api_auth_data.api_key_string = api_auth_data.api_key_string.strip()
|
129
|
-
if not api_auth_data.api_key_string:
|
130
|
-
api_auth_data.api_key_string = None
|
131
|
-
|
132
|
-
# parse user token
|
133
|
-
|
134
|
-
api_auth_data.user_token_string = ac.credentials if ac and ac.credentials and ac.credentials.strip() else None
|
135
|
-
|
136
|
-
if not api_auth_data.user_token_string and "token" in request.headers.keys():
|
137
|
-
api_auth_data.user_token_string = request.headers["token"]
|
138
|
-
|
139
|
-
if not api_auth_data.user_token_string and "user_token" in request.headers.keys():
|
140
|
-
api_auth_data.user_token_string = request.headers["user_token"]
|
141
|
-
if not api_auth_data.user_token_string and "user-token" in request.headers.keys():
|
142
|
-
api_auth_data.user_token_string = request.headers["user-token"]
|
143
|
-
if not api_auth_data.user_token_string and "usertoken" in request.headers.keys():
|
144
|
-
api_auth_data.user_token_string = request.headers["usertoken"]
|
145
|
-
|
146
|
-
if not api_auth_data.user_token_string and "token" in request.query_params.keys():
|
147
|
-
api_auth_data.user_token_string = request.query_params["token"]
|
148
|
-
|
149
|
-
if not api_auth_data.user_token_string and "user_token" in request.query_params.keys():
|
150
|
-
api_auth_data.user_token_string = request.query_params["user_token"]
|
151
|
-
if not api_auth_data.user_token_string and "user-token" in request.query_params.keys():
|
152
|
-
api_auth_data.user_token_string = request.query_params["user-token"]
|
153
|
-
if not api_auth_data.user_token_string and "usertoken" in request.query_params.keys():
|
154
|
-
api_auth_data.user_token_string = request.query_params["usertoken"]
|
155
|
-
|
156
|
-
if api_auth_data.user_token_string:
|
157
|
-
api_auth_data.user_token_string = api_auth_data.user_token_string.strip()
|
158
|
-
if not api_auth_data.user_token_string:
|
159
|
-
api_auth_data.user_token_string = None
|
160
|
-
|
161
|
-
# require_mode_type
|
162
|
-
|
163
|
-
if require_mode_type is not None:
|
164
|
-
if get_cached_settings().mode_type != require_mode_type:
|
165
|
-
raise APIException(
|
166
|
-
status_code=fastapi.status.HTTP_401_UNAUTHORIZED,
|
167
|
-
error_code=APIErrorCodes.cannot_authorize,
|
168
|
-
error_data=transfer_data_to_json_str_to_data(api_auth_data.model_dump())
|
169
|
-
)
|
170
|
-
|
171
|
-
# require_not_mode_type
|
172
|
-
|
173
|
-
if require_not_mode_type is not None:
|
174
|
-
if get_cached_settings().mode_type == require_not_mode_type:
|
175
|
-
raise APIException(
|
176
|
-
status_code=fastapi.status.HTTP_401_UNAUTHORIZED,
|
177
|
-
error_code=APIErrorCodes.cannot_authorize,
|
178
|
-
error_data=transfer_data_to_json_str_to_data(api_auth_data.model_dump())
|
179
|
-
)
|
180
|
-
|
181
|
-
# require_api_key_string
|
182
|
-
|
183
|
-
if require_api_key_string and not api_auth_data.api_key_string:
|
184
|
-
raise APIException(
|
185
|
-
status_code=fastapi.status.HTTP_401_UNAUTHORIZED,
|
186
|
-
error_code=APIErrorCodes.cannot_authorize,
|
187
|
-
error_data=transfer_data_to_json_str_to_data(api_auth_data.model_dump())
|
188
|
-
)
|
189
|
-
|
190
|
-
# require_token_string
|
191
|
-
|
192
|
-
if require_user_token_string and not api_auth_data.user_token_string:
|
193
|
-
raise APIException(
|
194
|
-
status_code=fastapi.status.HTTP_401_UNAUTHORIZED,
|
195
|
-
error_code=APIErrorCodes.cannot_authorize,
|
196
|
-
error_data=transfer_data_to_json_str_to_data(api_auth_data.model_dump())
|
197
|
-
)
|
198
|
-
|
199
|
-
# is_api_key_correct_func
|
200
|
-
|
201
|
-
if is_api_key_correct_func is not None:
|
202
|
-
if is_async_callable(is_api_key_correct_func):
|
203
|
-
await is_api_key_correct_func(
|
204
|
-
api_auth_data=api_auth_data,
|
205
|
-
request=request
|
206
|
-
)
|
207
|
-
elif is_sync_function(is_api_key_correct_func):
|
208
|
-
is_api_key_correct_func(
|
209
|
-
api_auth_data=api_auth_data,
|
210
|
-
request=request
|
211
|
-
)
|
212
|
-
else:
|
213
|
-
raise TypeError("unknown validate_api_key_func type")
|
214
|
-
|
215
|
-
# is_user_token_correct_func
|
216
|
-
|
217
|
-
if is_user_token_correct_func is not None:
|
218
|
-
if is_async_callable(is_user_token_correct_func):
|
219
|
-
await is_user_token_correct_func(
|
220
|
-
api_auth_data=api_auth_data,
|
221
|
-
request=request
|
222
|
-
)
|
223
|
-
elif is_sync_function(is_user_token_correct_func):
|
224
|
-
is_user_token_correct_func(
|
225
|
-
api_auth_data=api_auth_data,
|
226
|
-
request=request
|
227
|
-
)
|
228
|
-
else:
|
229
|
-
raise TypeError("unknown validate_token_func type")
|
230
|
-
|
231
|
-
# require_correct_api_key
|
232
|
-
|
233
|
-
if require_correct_api_key:
|
234
|
-
if not api_auth_data.is_api_key_correct:
|
235
|
-
raise APIException(
|
236
|
-
status_code=fastapi.status.HTTP_401_UNAUTHORIZED,
|
237
|
-
error_code=APIErrorCodes.cannot_authorize,
|
238
|
-
error_description="not api_auth_data.is_api_key_correct",
|
239
|
-
error_data=transfer_data_to_json_str_to_data(api_auth_data.model_dump()),
|
240
|
-
)
|
241
|
-
|
242
|
-
# require_correct_token
|
243
|
-
|
244
|
-
if require_correct_user_token:
|
245
|
-
if not api_auth_data.is_user_token_correct:
|
246
|
-
raise APIException(
|
247
|
-
status_code=fastapi.status.HTTP_401_UNAUTHORIZED,
|
248
|
-
error_code=APIErrorCodes.cannot_authorize,
|
249
|
-
error_description="not api_auth_data.is_user_token_correct",
|
250
|
-
error_data=transfer_data_to_json_str_to_data(api_auth_data.model_dump())
|
251
|
-
)
|
252
|
-
|
253
|
-
return api_auth_data
|
254
|
-
|
255
|
-
return func
|
256
|
-
|
257
|
-
|
258
|
-
def correct_api_keys_from_settings__is_api_key_correct_func() -> Callable:
|
259
|
-
async def async_func(
|
260
|
-
*,
|
261
|
-
api_auth_data: APIAuthData,
|
262
|
-
request: fastapi.requests.Request,
|
263
|
-
):
|
264
|
-
if get_cached_settings().api_correct_api_keys is None:
|
265
|
-
api_auth_data.is_api_key_correct = False
|
266
|
-
return
|
267
|
-
if api_auth_data.api_key_string is None:
|
268
|
-
api_auth_data.is_api_key_correct = False
|
269
|
-
return
|
270
|
-
if api_auth_data.api_key_string.strip() not in get_cached_settings().api_correct_api_keys:
|
271
|
-
api_auth_data.is_api_key_correct = False
|
272
|
-
return
|
273
|
-
api_auth_data.is_api_key_correct = True
|
274
|
-
return
|
275
|
-
|
276
|
-
return async_func
|
277
|
-
|
278
|
-
|
279
|
-
def correct_tokens_from_settings__is_user_token_correct_func() -> Callable:
|
280
|
-
async def async_func(
|
281
|
-
*,
|
282
|
-
api_auth_data: APIAuthData,
|
283
|
-
request: fastapi.requests.Request,
|
284
|
-
):
|
285
|
-
if get_cached_settings().api_correct_tokens is None:
|
286
|
-
api_auth_data.is_api_key_correct = False
|
287
|
-
return
|
288
|
-
if api_auth_data.user_token_string is None:
|
289
|
-
api_auth_data.is_api_key_correct = False
|
290
|
-
return
|
291
|
-
if api_auth_data.user_token_string.strip() not in get_cached_settings().api_correct_tokens:
|
292
|
-
api_auth_data.is_api_key_correct = False
|
293
|
-
return
|
294
|
-
api_auth_data.is_api_key_correct = True
|
295
|
-
return
|
296
|
-
|
297
|
-
return async_func
|
298
|
-
|
299
|
-
|
300
|
-
def correct_api_key_from_sqlalchemy_db__is_api_key_correct_func() -> Callable:
|
301
|
-
async def async_func(
|
302
|
-
*,
|
303
|
-
api_auth_data: APIAuthData,
|
304
|
-
request: fastapi.requests.Request,
|
305
|
-
):
|
306
|
-
if api_auth_data.api_key_string is None:
|
307
|
-
api_auth_data.is_api_key_correct = False
|
308
|
-
return
|
309
|
-
|
310
|
-
async with get_cached_sqlalchemy_db().new_async_session() as session:
|
311
|
-
api_auth_data.api_key_dbm = await session.scalar(
|
312
|
-
sqlalchemy.select(ApiKeyDBM).where(ApiKeyDBM.value == api_auth_data.api_key_string)
|
313
|
-
)
|
314
|
-
|
315
|
-
if api_auth_data.api_key_dbm is None or not api_auth_data.api_key_dbm.is_enabled:
|
316
|
-
api_auth_data.is_api_key_correct = False
|
317
|
-
return
|
318
|
-
|
319
|
-
api_auth_data.is_api_key_correct = True
|
320
|
-
return True
|
321
|
-
|
322
|
-
return async_func
|
323
|
-
|
324
|
-
|
325
|
-
def correct_user_token_from_sqlalchemy_db__is_user_token_correct_func(
|
326
|
-
*, require_user_roles: list[str] | None = None
|
327
|
-
) -> Callable:
|
328
|
-
async def async_func(
|
329
|
-
*,
|
330
|
-
api_auth_data: APIAuthData,
|
331
|
-
request: fastapi.requests.Request,
|
332
|
-
):
|
333
|
-
if api_auth_data.user_token_string is None:
|
334
|
-
api_auth_data.is_user_token_correct = False
|
335
|
-
return
|
336
|
-
|
337
|
-
with get_cached_sqlalchemy_db().new_session() as session:
|
338
|
-
api_auth_data.user_token_dbm = session.query(
|
339
|
-
UserTokenDBM
|
340
|
-
).filter(
|
341
|
-
UserTokenDBM.value == api_auth_data.user_token_string
|
342
|
-
).one_or_none()
|
343
|
-
|
344
|
-
if api_auth_data.user_token_dbm is None:
|
345
|
-
api_auth_data.is_user_token_correct = False
|
346
|
-
return
|
347
|
-
if not api_auth_data.user_token_dbm.is_enabled:
|
348
|
-
pass
|
349
|
-
|
350
|
-
api_auth_data.is_user_token_correct = True
|
351
|
-
return
|
352
|
-
|
353
|
-
return async_func
|
@@ -1,44 +0,0 @@
|
|
1
|
-
from functools import lru_cache
|
2
|
-
|
3
|
-
from emoji import emojize
|
4
|
-
|
5
|
-
from project.tg_bot.blank.common import SimpleBlankTgBot
|
6
|
-
|
7
|
-
|
8
|
-
class ClientTgBotBlank(SimpleBlankTgBot):
|
9
|
-
|
10
|
-
def command_to_desc(self) -> dict[str, str]:
|
11
|
-
return {}
|
12
|
-
|
13
|
-
def but_hello_world(self) -> str:
|
14
|
-
res = "hello_world"
|
15
|
-
return emojize(res.strip())
|
16
|
-
|
17
|
-
def hello_world(self) -> str:
|
18
|
-
res = ":waving_hand: <b>Hello world</b> :waving_hand:"
|
19
|
-
return emojize(res.strip())
|
20
|
-
|
21
|
-
def healthcheck(self) -> str:
|
22
|
-
res = "healthcheck"
|
23
|
-
return emojize(res.strip())
|
24
|
-
|
25
|
-
def welcome(self) -> str:
|
26
|
-
res = ":waving_hand: <b>Welcome</b> :waving_hand:"
|
27
|
-
return emojize(res.strip())
|
28
|
-
|
29
|
-
|
30
|
-
def create_client_tg_bot_blank() -> ClientTgBotBlank:
|
31
|
-
return ClientTgBotBlank()
|
32
|
-
|
33
|
-
|
34
|
-
@lru_cache()
|
35
|
-
def get_cached_client_tg_bot_blank() -> ClientTgBotBlank:
|
36
|
-
return ClientTgBotBlank()
|
37
|
-
|
38
|
-
|
39
|
-
def __example():
|
40
|
-
print(get_cached_client_tg_bot_blank().welcome())
|
41
|
-
|
42
|
-
|
43
|
-
if __name__ == '__main__':
|
44
|
-
__example()
|
@@ -1,37 +0,0 @@
|
|
1
|
-
import logging
|
2
|
-
|
3
|
-
import aiogram
|
4
|
-
from aiogram import Router
|
5
|
-
|
6
|
-
from arpakitlib.ar_exception_util import exception_to_traceback_str
|
7
|
-
from project.sqlalchemy_db_.sqlalchemy_db import get_cached_sqlalchemy_db
|
8
|
-
from project.sqlalchemy_db_.sqlalchemy_model import StoryLogDBM
|
9
|
-
from project.tg_bot.middleware.common import MiddlewareDataTgBot
|
10
|
-
|
11
|
-
_logger = logging.getLogger(__name__)
|
12
|
-
|
13
|
-
tg_bot_router = Router()
|
14
|
-
|
15
|
-
|
16
|
-
@tg_bot_router.error()
|
17
|
-
async def _(
|
18
|
-
event: aiogram.types.ErrorEvent,
|
19
|
-
middleware_data_tg_bot: MiddlewareDataTgBot,
|
20
|
-
**kwargs
|
21
|
-
):
|
22
|
-
_logger.exception(event.exception)
|
23
|
-
|
24
|
-
if get_cached_sqlalchemy_db() is not None:
|
25
|
-
async with get_cached_sqlalchemy_db().new_async_session() as session:
|
26
|
-
story_log_dbm = StoryLogDBM(
|
27
|
-
level=StoryLogDBM.Levels.error,
|
28
|
-
type=StoryLogDBM.Types.error_in_tg_bot,
|
29
|
-
title=f"{type(event.exception)}",
|
30
|
-
data={
|
31
|
-
"exception_str": str(event.exception),
|
32
|
-
"exception_traceback_str": exception_to_traceback_str(exception=event.exception)
|
33
|
-
}
|
34
|
-
)
|
35
|
-
session.add(story_log_dbm)
|
36
|
-
await session.commit()
|
37
|
-
await session.refresh(story_log_dbm)
|
@@ -1,27 +0,0 @@
|
|
1
|
-
import aiogram.types
|
2
|
-
from aiogram.filters import Filter
|
3
|
-
|
4
|
-
from project.sqlalchemy_db_.sqlalchemy_db import get_cached_sqlalchemy_db
|
5
|
-
from project.sqlalchemy_db_.sqlalchemy_model import UserDBM
|
6
|
-
|
7
|
-
|
8
|
-
class UserRolesHasAdminTgBotFilter(Filter):
|
9
|
-
|
10
|
-
async def __call__(
|
11
|
-
self, update: aiogram.types.Message | aiogram.types.CallbackQuery | aiogram.types.TelegramObject, **kwargs
|
12
|
-
) -> bool:
|
13
|
-
tg_user: None | aiogram.types.User = None
|
14
|
-
|
15
|
-
if isinstance(update, aiogram.types.Message) and update.from_user is not None:
|
16
|
-
tg_user = update.from_user
|
17
|
-
if isinstance(update, aiogram.types.CallbackQuery) and update.from_user is not None:
|
18
|
-
tg_user = update.from_user
|
19
|
-
|
20
|
-
if get_cached_sqlalchemy_db() is not None and tg_user is not None:
|
21
|
-
with get_cached_sqlalchemy_db().new_session() as session:
|
22
|
-
user_dbm: UserDBM | None = session.query(UserDBM).filter(UserDBM.tg_id == tg_user.id).one_or_none()
|
23
|
-
if user_dbm is not None:
|
24
|
-
if user_dbm.roles_has_admin:
|
25
|
-
return True
|
26
|
-
|
27
|
-
return False
|
@@ -1,27 +0,0 @@
|
|
1
|
-
import aiogram.types
|
2
|
-
from aiogram.filters import Filter
|
3
|
-
|
4
|
-
from project.sqlalchemy_db_.sqlalchemy_db import get_cached_sqlalchemy_db
|
5
|
-
from project.sqlalchemy_db_.sqlalchemy_model import UserDBM
|
6
|
-
|
7
|
-
|
8
|
-
class UserRolesHasClientTgBotFilter(Filter):
|
9
|
-
|
10
|
-
async def __call__(
|
11
|
-
self, update: aiogram.types.Message | aiogram.types.CallbackQuery | aiogram.types.TelegramObject, **kwargs
|
12
|
-
) -> bool:
|
13
|
-
tg_user: None | aiogram.types.User = None
|
14
|
-
|
15
|
-
if isinstance(update, aiogram.types.Message) and update.from_user is not None:
|
16
|
-
tg_user = update.from_user
|
17
|
-
if isinstance(update, aiogram.types.CallbackQuery) and update.from_user is not None:
|
18
|
-
tg_user = update.from_user
|
19
|
-
|
20
|
-
if get_cached_sqlalchemy_db() is not None and tg_user is not None:
|
21
|
-
with get_cached_sqlalchemy_db().new_session() as session:
|
22
|
-
user_dbm: UserDBM | None = session.query(UserDBM).filter(UserDBM.tg_id == tg_user.id).one_or_none()
|
23
|
-
if user_dbm is not None:
|
24
|
-
if user_dbm.roles_has_client:
|
25
|
-
return True
|
26
|
-
|
27
|
-
return False
|
@@ -1,15 +0,0 @@
|
|
1
|
-
from aiogram import Router
|
2
|
-
|
3
|
-
from project.tg_bot.filter_.is_private_chat import IsPrivateChatTgBotFilter
|
4
|
-
from project.tg_bot.filter_.user_roles_has_admin import UserRolesHasAdminTgBotFilter
|
5
|
-
from project.tg_bot.router.admin import reinit_sqlalchemy_db, arpakitlib_project_template_info, raise_fake_error, me
|
6
|
-
|
7
|
-
main_admin_tg_bot_router = Router()
|
8
|
-
for observer in main_admin_tg_bot_router.observers.values():
|
9
|
-
observer.filter(UserRolesHasAdminTgBotFilter())
|
10
|
-
observer.filter(IsPrivateChatTgBotFilter())
|
11
|
-
|
12
|
-
main_admin_tg_bot_router.include_router(reinit_sqlalchemy_db.tg_bot_router)
|
13
|
-
main_admin_tg_bot_router.include_router(arpakitlib_project_template_info.tg_bot_router)
|
14
|
-
main_admin_tg_bot_router.include_router(raise_fake_error.tg_bot_router)
|
15
|
-
main_admin_tg_bot_router.include_router(me.tg_bot_router)
|
@@ -1,14 +0,0 @@
|
|
1
|
-
from aiogram import Router
|
2
|
-
|
3
|
-
from project.tg_bot.filter_.user_roles_has_client import UserRolesHasClientTgBotFilter
|
4
|
-
from project.tg_bot.router.client import start, healthcheck, hello_world
|
5
|
-
|
6
|
-
main_client_tg_bot_router = Router()
|
7
|
-
for observer in main_client_tg_bot_router.observers.values():
|
8
|
-
observer.filter(UserRolesHasClientTgBotFilter())
|
9
|
-
|
10
|
-
main_client_tg_bot_router.include_router(router=start.tg_bot_router)
|
11
|
-
|
12
|
-
main_client_tg_bot_router.include_router(router=healthcheck.tg_bot_router)
|
13
|
-
|
14
|
-
main_client_tg_bot_router.include_router(router=hello_world.tg_bot_router)
|
@@ -1,13 +0,0 @@
|
|
1
|
-
from aiogram import Router
|
2
|
-
|
3
|
-
from project.tg_bot import error_handler
|
4
|
-
from project.tg_bot.router.admin.main_router import main_admin_tg_bot_router
|
5
|
-
from project.tg_bot.router.client.main_router import main_client_tg_bot_router
|
6
|
-
|
7
|
-
main_tg_bot_router = Router()
|
8
|
-
|
9
|
-
main_tg_bot_router.include_router(router=error_handler.tg_bot_router)
|
10
|
-
|
11
|
-
main_tg_bot_router.include_router(router=main_admin_tg_bot_router)
|
12
|
-
|
13
|
-
main_tg_bot_router.include_router(router=main_client_tg_bot_router)
|