arpakitlib 1.7.257__py3-none-any.whl → 1.8.1__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 → _arpakit_project_template_v_1}/README.md +1 -1
- arpakitlib/{_arpakit_project_template → _arpakit_project_template_v_1}/alembic/env.py +3 -3
- arpakitlib/_arpakit_project_template_v_1/api/asgi.py +3 -0
- arpakitlib/_arpakit_project_template_v_1/api/auth.py +235 -0
- arpakitlib/_arpakit_project_template_v_1/api/const.py +18 -0
- arpakitlib/_arpakit_project_template_v_1/api/create_api_app.py +71 -0
- arpakitlib/_arpakit_project_template_v_1/api/event.py +74 -0
- arpakitlib/_arpakit_project_template_v_1/api/exception.py +38 -0
- arpakitlib/_arpakit_project_template_v_1/api/exception_handler.py +308 -0
- arpakitlib/_arpakit_project_template_v_1/api/openapi_ui.py +28 -0
- arpakitlib/_arpakit_project_template_v_1/api/response.py +31 -0
- arpakitlib/{_arpakit_project_template/src → _arpakit_project_template_v_1}/api/router/main_router.py +4 -3
- arpakitlib/_arpakit_project_template_v_1/api/router/v1/arpakit_project_template.py +22 -0
- arpakitlib/_arpakit_project_template_v_1/api/router/v1/check_auth.py +30 -0
- arpakitlib/_arpakit_project_template_v_1/api/router/v1/clear_log_file.py +25 -0
- arpakitlib/_arpakit_project_template_v_1/api/router/v1/get_errors_info.py +24 -0
- arpakitlib/_arpakit_project_template_v_1/api/router/v1/get_log_file.py +23 -0
- arpakitlib/_arpakit_project_template_v_1/api/router/v1/healthcheck.py +21 -0
- arpakitlib/_arpakit_project_template_v_1/api/router/v1/main_router.py +67 -0
- arpakitlib/_arpakit_project_template_v_1/api/router/v1/now_utc_datetime.py +21 -0
- arpakitlib/_arpakit_project_template_v_1/api/router/v1/raise_fake_error.py +35 -0
- arpakitlib/_arpakit_project_template_v_1/api/schema/base_schema.py +26 -0
- arpakitlib/_arpakit_project_template_v_1/api/schema/common/in_.py +5 -0
- arpakitlib/_arpakit_project_template_v_1/api/schema/common/out.py +60 -0
- arpakitlib/_arpakit_project_template_v_1/api/schema/v1/in_.py +5 -0
- arpakitlib/_arpakit_project_template_v_1/api/schema/v1/out.py +47 -0
- arpakitlib/_arpakit_project_template_v_1/arpakitlib_project_template.json +3 -0
- arpakitlib/{_arpakit_project_template/src → _arpakit_project_template_v_1}/business_service/hello_world.py +1 -1
- arpakitlib/_arpakit_project_template_v_1/business_service/remove_operations.py +51 -0
- arpakitlib/_arpakit_project_template_v_1/command/alembic_history.sh +2 -0
- arpakitlib/_arpakit_project_template_v_1/command/alembic_revision_autogenerate.sh +2 -0
- arpakitlib/{_arpakit_project_template/manage/json_beautify.py → _arpakit_project_template_v_1/command/beautify_json.py} +2 -2
- arpakitlib/{_arpakit_project_template/src/core/_check_logging.py → _arpakit_project_template_v_1/command/check_logging.py} +3 -3
- arpakitlib/_arpakit_project_template_v_1/command/check_sqlalchemy_db.py +11 -0
- arpakitlib/_arpakit_project_template_v_1/command/drop_json_db.py +13 -0
- arpakitlib/_arpakit_project_template_v_1/command/drop_sqlalchemy_db.py +14 -0
- arpakitlib/{_arpakit_project_template/src/core/_generate_settings_env_example.py → _arpakit_project_template_v_1/command/generate_settings_env_example.py} +4 -4
- arpakitlib/{_arpakit_project_template/manage → _arpakit_project_template_v_1/command}/hello_world.py +2 -2
- arpakitlib/_arpakit_project_template_v_1/command/init_json_db.py +11 -0
- arpakitlib/_arpakit_project_template_v_1/command/init_sqlalchemy_db.py +11 -0
- arpakitlib/_arpakit_project_template_v_1/command/reinit_json_db.py +13 -0
- arpakitlib/_arpakit_project_template_v_1/command/reinit_sqlalchemy_db.py +13 -0
- arpakitlib/_arpakit_project_template_v_1/command/remove_operations.py +13 -0
- arpakitlib/_arpakit_project_template_v_1/command/remove_story_logs.py +16 -0
- arpakitlib/_arpakit_project_template_v_1/command/rm_all_records_in_json_db.py +13 -0
- arpakitlib/{_arpakit_project_template/src/core/_show_settings.py → _arpakit_project_template_v_1/command/show_settings.py} +3 -3
- arpakitlib/{_arpakit_project_template/src/api/_start_api_with_reload.py → _arpakit_project_template_v_1/command/start_api_with_reload.py} +5 -5
- arpakitlib/{_arpakit_project_template/src/api/_start_api_without_reload.py → _arpakit_project_template_v_1/command/start_api_without_reload.py} +5 -5
- arpakitlib/_arpakit_project_template_v_1/command/start_async_operation_executor_worker.py +14 -0
- arpakitlib/_arpakit_project_template_v_1/command/start_async_scheduled_operation_creator_worker.py +14 -0
- arpakitlib/_arpakit_project_template_v_1/command/start_sync_operation_executor_worker.py +15 -0
- arpakitlib/_arpakit_project_template_v_1/command/start_sync_operation_executor_workers.py +22 -0
- arpakitlib/_arpakit_project_template_v_1/command/start_sync_scheduled_operation_creator_worker.py +12 -0
- arpakitlib/_arpakit_project_template_v_1/core/cache_file_storage_in_dir.py +23 -0
- arpakitlib/_arpakit_project_template_v_1/core/const.py +33 -0
- arpakitlib/_arpakit_project_template_v_1/core/dump_file_storage_in_dir.py +23 -0
- arpakitlib/_arpakit_project_template_v_1/core/jinja2_templates.py +14 -0
- arpakitlib/_arpakit_project_template_v_1/core/media_file_storage_in_dir.py +23 -0
- arpakitlib/_arpakit_project_template_v_1/core/settings.py +195 -0
- arpakitlib/_arpakit_project_template_v_1/core/util.py +29 -0
- arpakitlib/{_arpakit_project_template → _arpakit_project_template_v_1}/example.env +13 -7
- arpakitlib/_arpakit_project_template_v_1/json_db/json_db.py +28 -0
- arpakitlib/_arpakit_project_template_v_1/operation_execution/operation_executor_worker.py +256 -0
- arpakitlib/_arpakit_project_template_v_1/operation_execution/scheduled_operation_creator_worker.py +106 -0
- arpakitlib/_arpakit_project_template_v_1/operation_execution/scheduled_operations.py +49 -0
- arpakitlib/_arpakit_project_template_v_1/operation_execution/util.py +29 -0
- arpakitlib/_arpakit_project_template_v_1/resource/static/openapi-favicon.png +0 -0
- arpakitlib/_arpakit_project_template_v_1/resource/static/swagger-ui/index.html +19 -0
- arpakitlib/_arpakit_project_template_v_1/resource/static/swagger-ui/swagger-ui-bundle.js +2 -0
- arpakitlib/{ar_fastapi_static → _arpakit_project_template_v_1/resource/static}/swagger-ui/swagger-ui-es-bundle-core.js +1 -1
- arpakitlib/_arpakit_project_template_v_1/resource/static/swagger-ui/swagger-ui-es-bundle-core.js.map +1 -0
- arpakitlib/_arpakit_project_template_v_1/resource/static/swagger-ui/swagger-ui-es-bundle.js +2 -0
- arpakitlib/_arpakit_project_template_v_1/resource/static/swagger-ui/swagger-ui-standalone-preset.js +2 -0
- arpakitlib/{ar_fastapi_static → _arpakit_project_template_v_1/resource/static}/swagger-ui/swagger-ui.js +1 -1
- arpakitlib/_arpakit_project_template_v_1/resource/static/swagger-ui/swagger-ui.js.map +1 -0
- arpakitlib/_arpakit_project_template_v_1/sandbox/sandbox_1.py +14 -0
- arpakitlib/_arpakit_project_template_v_1/sandbox/sandbox_2.py +14 -0
- arpakitlib/_arpakit_project_template_v_1/sandbox/sandbox_3.py +14 -0
- arpakitlib/_arpakit_project_template_v_1/sandbox/sandbox_4.py +14 -0
- arpakitlib/_arpakit_project_template_v_1/sandbox/sandbox_5.py +14 -0
- arpakitlib/_arpakit_project_template_v_1/sandbox/sandbox_6.py +14 -0
- arpakitlib/_arpakit_project_template_v_1/sandbox/sandbox_7.py +14 -0
- arpakitlib/_arpakit_project_template_v_1/site/router/main_router.py +3 -0
- arpakitlib/_arpakit_project_template_v_1/sqladmin_/add_admin_in_app.py +24 -0
- arpakitlib/_arpakit_project_template_v_1/sqladmin_/admin_auth.py +54 -0
- arpakitlib/_arpakit_project_template_v_1/sqladmin_/model_view.py +95 -0
- arpakitlib/_arpakit_project_template_v_1/sqlalchemy_db/sqlalchemy_db.py +22 -0
- arpakitlib/_arpakit_project_template_v_1/sqlalchemy_db/sqlalchemy_model.py +129 -0
- arpakitlib/_arpakit_project_template_v_1/sqlalchemy_db/util.py +28 -0
- arpakitlib/{_arpakit_project_template/src/sandbox/sandbox_3.py → _arpakit_project_template_v_1/test_data/make_test_data_1.py} +8 -3
- arpakitlib/{_arpakit_project_template/src/sandbox/sandbox_4.py → _arpakit_project_template_v_1/test_data/make_test_data_2.py} +8 -3
- arpakitlib/{_arpakit_project_template/src/sandbox/sandbox_1.py → _arpakit_project_template_v_1/test_data/make_test_data_3.py} +8 -3
- arpakitlib/{_arpakit_project_template/src/sandbox/sandbox_2.py → _arpakit_project_template_v_1/test_data/make_test_data_4.py} +8 -3
- arpakitlib/_arpakit_project_template_v_1/test_data/make_test_data_5.py +22 -0
- arpakitlib/_arpakit_project_template_v_1/tg_bot/blank/blank.py +5 -0
- arpakitlib/{_arpakit_project_template/src → _arpakit_project_template_v_1}/tg_bot/blank/util.py +1 -1
- arpakitlib/{_arpakit_project_template/src → _arpakit_project_template_v_1}/tg_bot/const.py +6 -3
- arpakitlib/_arpakit_project_template_v_1/tg_bot/event.py +51 -0
- arpakitlib/{_arpakit_project_template/src → _arpakit_project_template_v_1}/tg_bot/filter/not_prod_mode.py +1 -1
- arpakitlib/{_arpakit_project_template/src → _arpakit_project_template_v_1}/tg_bot/filter/prod_mode.py +1 -1
- arpakitlib/_arpakit_project_template_v_1/tg_bot/kb/static_/__init__.py +0 -0
- arpakitlib/_arpakit_project_template_v_1/tg_bot/kb/static_/common.py +0 -0
- arpakitlib/_arpakit_project_template_v_1/tg_bot/middleware/__init__.py +0 -0
- arpakitlib/_arpakit_project_template_v_1/tg_bot/middleware/init_user.py +24 -0
- arpakitlib/_arpakit_project_template_v_1/tg_bot/middleware/middleware.py +12 -0
- arpakitlib/_arpakit_project_template_v_1/tg_bot/router/__init__.py +0 -0
- arpakitlib/_arpakit_project_template_v_1/tg_bot/router/arpakitlib_.py +10 -0
- arpakitlib/_arpakit_project_template_v_1/tg_bot/router/error.py +15 -0
- arpakitlib/_arpakit_project_template_v_1/tg_bot/router/healthcheck.py +10 -0
- arpakitlib/_arpakit_project_template_v_1/tg_bot/router/main_router.py +14 -0
- arpakitlib/_arpakit_project_template_v_1/tg_bot/start_tg_bot.py +34 -0
- arpakitlib/_arpakit_project_template_v_1/tg_bot/tg_bot.py +24 -0
- arpakitlib/_arpakit_project_template_v_1/tg_bot/tg_bot_dispatcher.py +19 -0
- arpakitlib/_arpakit_project_template_v_1/tg_bot/transmitted_tg_data.py +58 -0
- arpakitlib/_arpakit_project_template_v_1/tg_bot/util.py +0 -0
- arpakitlib/_arpakit_project_template_v_1/util/__init__.py +0 -0
- arpakitlib/_arpakit_project_template_v_1/util/read_arpakitlib_project_template_file.py +17 -0
- arpakitlib/ar_aiogram_util.py +41 -52
- arpakitlib/ar_arpakit_project_template_util.py +5 -11
- arpakitlib/ar_arpakitlib_cli_util.py +8 -2
- arpakitlib/ar_base_worker_util.py +35 -17
- arpakitlib/ar_class_util.py +11 -0
- arpakitlib/ar_func_util.py +19 -29
- arpakitlib/ar_http_request_util.py +10 -2
- arpakitlib/ar_rat_func_util.py +1 -1
- arpakitlib/ar_retry_func_util.py +4 -4
- arpakitlib/ar_schedule_uust_api_client_util.py +1 -1
- arpakitlib/ar_settings_util.py +3 -204
- arpakitlib/ar_sqladmin_util.py +7 -102
- arpakitlib/ar_sqlalchemy_util.py +65 -13
- arpakitlib/ar_type_util.py +0 -2
- {arpakitlib-1.7.257.dist-info → arpakitlib-1.8.1.dist-info}/METADATA +5 -3
- arpakitlib-1.8.1.dist-info/RECORD +261 -0
- {arpakitlib-1.7.257.dist-info → arpakitlib-1.8.1.dist-info}/WHEEL +1 -1
- arpakitlib/_arpakit_project_template/ARPAKITLIB +0 -1
- arpakitlib/_arpakit_project_template/manage/docker_ps.sh +0 -2
- arpakitlib/_arpakit_project_template/manage/git_branch.sh +0 -2
- arpakitlib/_arpakit_project_template/manage/poetry_add_plugin_export.sh +0 -2
- arpakitlib/_arpakit_project_template/manage/poetry_config_virtualenvs_in_project_true.sh +0 -2
- arpakitlib/_arpakit_project_template/manage/poetry_self_add_plugin_export.sh +0 -2
- arpakitlib/_arpakit_project_template/src/admin1/add_admin_in_app.py +0 -32
- arpakitlib/_arpakit_project_template/src/admin1/admin_auth.py +0 -29
- arpakitlib/_arpakit_project_template/src/admin1/model_view.py +0 -1
- arpakitlib/_arpakit_project_template/src/api/asgi.py +0 -3
- arpakitlib/_arpakit_project_template/src/api/auth.py +0 -53
- arpakitlib/_arpakit_project_template/src/api/const.py +0 -13
- arpakitlib/_arpakit_project_template/src/api/create_api_app.py +0 -43
- arpakitlib/_arpakit_project_template/src/api/create_handle_exception_.py +0 -59
- arpakitlib/_arpakit_project_template/src/api/event.py +0 -83
- arpakitlib/_arpakit_project_template/src/api/router/v1/get_api_error_info.py +0 -27
- arpakitlib/_arpakit_project_template/src/api/router/v1/main_router.py +0 -15
- arpakitlib/_arpakit_project_template/src/api/schema/v1/in_.py +0 -1
- arpakitlib/_arpakit_project_template/src/api/schema/v1/out.py +0 -1
- arpakitlib/_arpakit_project_template/src/api/transmitted_api_data.py +0 -7
- arpakitlib/_arpakit_project_template/src/api/util.py +0 -44
- arpakitlib/_arpakit_project_template/src/core/const.py +0 -41
- arpakitlib/_arpakit_project_template/src/core/settings.py +0 -21
- arpakitlib/_arpakit_project_template/src/core/util.py +0 -61
- arpakitlib/_arpakit_project_template/src/json_db/_drop_json_db.py +0 -13
- arpakitlib/_arpakit_project_template/src/json_db/_init_json_db.py +0 -11
- arpakitlib/_arpakit_project_template/src/json_db/_reinit_json_db.py +0 -13
- arpakitlib/_arpakit_project_template/src/json_db/_rm_all_records_in_json_db.py +0 -13
- arpakitlib/_arpakit_project_template/src/json_db/json_db.py +0 -11
- arpakitlib/_arpakit_project_template/src/json_db/util.py +0 -17
- arpakitlib/_arpakit_project_template/src/just_script/example.py +0 -16
- arpakitlib/_arpakit_project_template/src/operation_execution/_start_operation_executor_worker.py +0 -17
- arpakitlib/_arpakit_project_template/src/operation_execution/_start_scheduled_operation_creator_worker.py +0 -17
- arpakitlib/_arpakit_project_template/src/operation_execution/const.py +0 -9
- arpakitlib/_arpakit_project_template/src/operation_execution/operation_executor.py +0 -16
- arpakitlib/_arpakit_project_template/src/operation_execution/scheduled_operations.py +0 -29
- arpakitlib/_arpakit_project_template/src/operation_execution/util.py +0 -1
- arpakitlib/_arpakit_project_template/src/sandbox/sandbox_5.py +0 -17
- arpakitlib/_arpakit_project_template/src/sandbox/sandbox_6.py +0 -17
- arpakitlib/_arpakit_project_template/src/sandbox/sandbox_7.py +0 -17
- arpakitlib/_arpakit_project_template/src/sqlalchemy_db/_check_conn_sqlalchemy_db.py +0 -11
- arpakitlib/_arpakit_project_template/src/sqlalchemy_db/_drop_sqlalchemy_db.py +0 -13
- arpakitlib/_arpakit_project_template/src/sqlalchemy_db/_init_sqlalchemy_db.py +0 -11
- arpakitlib/_arpakit_project_template/src/sqlalchemy_db/_reinit_sqlalchemy_db.py +0 -13
- arpakitlib/_arpakit_project_template/src/sqlalchemy_db/_remove_operations.py +0 -15
- arpakitlib/_arpakit_project_template/src/sqlalchemy_db/_remove_story_logs.py +0 -16
- arpakitlib/_arpakit_project_template/src/sqlalchemy_db/sqlalchemy_model.py +0 -13
- arpakitlib/_arpakit_project_template/src/sqlalchemy_db/util.py +0 -27
- arpakitlib/_arpakit_project_template/src/test_data/make_test_data_1.py +0 -8
- arpakitlib/_arpakit_project_template/src/test_data/make_test_data_2.py +0 -8
- arpakitlib/_arpakit_project_template/src/test_data/make_test_data_3.py +0 -8
- arpakitlib/_arpakit_project_template/src/test_data/make_test_data_4.py +0 -8
- arpakitlib/_arpakit_project_template/src/test_data/make_test_data_5.py +0 -8
- arpakitlib/_arpakit_project_template/src/tg_bot/blank/blank.py +0 -10
- arpakitlib/_arpakit_project_template/src/tg_bot/event.py +0 -39
- arpakitlib/_arpakit_project_template/src/tg_bot/router/error.py +0 -3
- arpakitlib/_arpakit_project_template/src/tg_bot/router/router.py +0 -7
- arpakitlib/_arpakit_project_template/src/tg_bot/start_tg_bot.py +0 -11
- arpakitlib/_arpakit_project_template/src/tg_bot/transmitted_tg_data.py +0 -6
- arpakitlib/_arpakit_project_template/src/tg_bot/util.py +0 -44
- arpakitlib/ar_api_key_util.py +0 -21
- arpakitlib/ar_fastapi_static/swagger-ui/index.html +0 -19
- arpakitlib/ar_fastapi_static/swagger-ui/swagger-ui-bundle.js +0 -2
- arpakitlib/ar_fastapi_static/swagger-ui/swagger-ui-es-bundle-core.js.map +0 -1
- arpakitlib/ar_fastapi_static/swagger-ui/swagger-ui-es-bundle.js +0 -2
- arpakitlib/ar_fastapi_static/swagger-ui/swagger-ui-standalone-preset.js +0 -2
- arpakitlib/ar_fastapi_static/swagger-ui/swagger-ui.js.map +0 -1
- arpakitlib/ar_fastapi_util.py +0 -862
- arpakitlib/ar_operation_execution_util.py +0 -504
- arpakitlib/ar_sqlalchemy_model_util.py +0 -183
- arpakitlib-1.7.257.dist-info/RECORD +0 -236
- /arpakitlib/{_arpakit_project_template → _arpakit_project_template_v_1}/.gitignore +0 -0
- /arpakitlib/{_arpakit_project_template → _arpakit_project_template_v_1}/.python-version +0 -0
- /arpakitlib/{_arpakit_project_template → _arpakit_project_template_v_1}/LICENSE +0 -0
- /arpakitlib/{_arpakit_project_template/manage → _arpakit_project_template_v_1/additional_model}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template/src → _arpakit_project_template_v_1}/additional_model/additional_model.py +0 -0
- /arpakitlib/{_arpakit_project_template → _arpakit_project_template_v_1}/alembic/README +0 -0
- /arpakitlib/{_arpakit_project_template → _arpakit_project_template_v_1}/alembic/script.py.mako +0 -0
- /arpakitlib/{_arpakit_project_template → _arpakit_project_template_v_1}/alembic.ini +0 -0
- /arpakitlib/{_arpakit_project_template/manage/note → _arpakit_project_template_v_1/api}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template/resource → _arpakit_project_template_v_1/api/router}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template/resource/static → _arpakit_project_template_v_1/api/router/v1}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template/src → _arpakit_project_template_v_1/api/schema}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template/src/additional_model → _arpakit_project_template_v_1/api/schema/common}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template/src/admin1 → _arpakit_project_template_v_1/api/schema/v1}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template/manage/note/note_1.txt → _arpakit_project_template_v_1/api/util.py} +0 -0
- /arpakitlib/{_arpakit_project_template/src/api → _arpakit_project_template_v_1/business_service}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template/src/api/router → _arpakit_project_template_v_1/celery_}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template/src/api/router/v1 → _arpakit_project_template_v_1/command}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template/manage → _arpakit_project_template_v_1/command}/alembic_upgrade_head .sh +0 -0
- /arpakitlib/{_arpakit_project_template/manage → _arpakit_project_template_v_1/command}/docker_ps_a.sh +0 -0
- /arpakitlib/{_arpakit_project_template/manage → _arpakit_project_template_v_1/command}/docker_rm_postgres.sh +0 -0
- /arpakitlib/{_arpakit_project_template/manage → _arpakit_project_template_v_1/command}/docker_run_postgres.sh +0 -0
- /arpakitlib/{_arpakit_project_template/manage → _arpakit_project_template_v_1/command}/docker_start_postgres.sh +0 -0
- /arpakitlib/{_arpakit_project_template/manage → _arpakit_project_template_v_1/command}/docker_stop_postgres.sh +0 -0
- /arpakitlib/{_arpakit_project_template/manage → _arpakit_project_template_v_1/command}/git_commit.sh +0 -0
- /arpakitlib/{_arpakit_project_template/manage → _arpakit_project_template_v_1/command}/git_push_arpakit_company_github_1.sh +0 -0
- /arpakitlib/{_arpakit_project_template/manage → _arpakit_project_template_v_1/command}/git_push_arpakit_company_gitlab_1.sh +0 -0
- /arpakitlib/{_arpakit_project_template/manage → _arpakit_project_template_v_1/command}/git_push_arpakit_github_1.sh +0 -0
- /arpakitlib/{_arpakit_project_template/manage → _arpakit_project_template_v_1/command}/git_push_arpakit_gitlab_1.sh +0 -0
- /arpakitlib/{_arpakit_project_template/manage/git_remote_v.sh → _arpakit_project_template_v_1/command/git_remote.sh} +0 -0
- /arpakitlib/{_arpakit_project_template/manage → _arpakit_project_template_v_1/command}/git_set_arpakit_company_origin.sh +0 -0
- /arpakitlib/{_arpakit_project_template/manage → _arpakit_project_template_v_1/command}/git_set_arpakit_origin.sh +0 -0
- /arpakitlib/{_arpakit_project_template/manage → _arpakit_project_template_v_1/command}/git_status.sh +0 -0
- /arpakitlib/{_arpakit_project_template/manage → _arpakit_project_template_v_1/command}/poetry_check.sh +0 -0
- /arpakitlib/{_arpakit_project_template/manage → _arpakit_project_template_v_1/command}/poetry_clear_cache.sh +0 -0
- /arpakitlib/{_arpakit_project_template/manage → _arpakit_project_template_v_1/command}/poetry_config.sh +0 -0
- /arpakitlib/{_arpakit_project_template/manage → _arpakit_project_template_v_1/command}/poetry_install.sh +0 -0
- /arpakitlib/{_arpakit_project_template/manage → _arpakit_project_template_v_1/command}/poetry_lock.sh +0 -0
- /arpakitlib/{_arpakit_project_template/manage → _arpakit_project_template_v_1/command}/poetry_remove_and_add_arpakitlib.sh +0 -0
- /arpakitlib/{_arpakit_project_template/manage → _arpakit_project_template_v_1/command}/poetry_show.sh +0 -0
- /arpakitlib/{_arpakit_project_template/manage → _arpakit_project_template_v_1/command}/poetry_show_arpakitlib.sh +0 -0
- /arpakitlib/{_arpakit_project_template/manage → _arpakit_project_template_v_1/command}/poetry_update.sh +0 -0
- /arpakitlib/{_arpakit_project_template/manage → _arpakit_project_template_v_1/command}/poetry_update_arpakitlib.sh +0 -0
- /arpakitlib/{_arpakit_project_template/src/api/schema → _arpakit_project_template_v_1/core}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template/src/api/schema/v1 → _arpakit_project_template_v_1/json_db}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template/src/business_service → _arpakit_project_template_v_1/note}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template/manage/note/note_2.txt → _arpakit_project_template_v_1/note/note_1.txt} +0 -0
- /arpakitlib/{_arpakit_project_template/manage/note/note_3.txt → _arpakit_project_template_v_1/note/note_2.txt} +0 -0
- /arpakitlib/{_arpakit_project_template/manage/note/note_4.txt → _arpakit_project_template_v_1/note/note_3.txt} +0 -0
- /arpakitlib/{_arpakit_project_template/manage/note/note_5.txt → _arpakit_project_template_v_1/note/note_4.txt} +0 -0
- /arpakitlib/{_arpakit_project_template/src/core/__init__.py → _arpakit_project_template_v_1/note/note_5.txt} +0 -0
- /arpakitlib/{_arpakit_project_template/src/json_db → _arpakit_project_template_v_1/operation_execution}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template/src/just_script/__init__.py → _arpakit_project_template_v_1/operation_execution/const.py} +0 -0
- /arpakitlib/{_arpakit_project_template/src/operation_execution → _arpakit_project_template_v_1/resource}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template/resource/static/healthcheck → _arpakit_project_template_v_1/resource/static/1} +0 -0
- /arpakitlib/{ar_fastapi_static → _arpakit_project_template_v_1/resource/static}/healthcheck +0 -0
- /arpakitlib/{_arpakit_project_template → _arpakit_project_template_v_1}/resource/static/helloworld +0 -0
- /arpakitlib/{ar_fastapi_static → _arpakit_project_template_v_1/resource/static}/redoc/redoc.standalone.js +0 -0
- /arpakitlib/{ar_fastapi_static → _arpakit_project_template_v_1/resource/static}/swagger-ui/favicon-16x16.png +0 -0
- /arpakitlib/{ar_fastapi_static → _arpakit_project_template_v_1/resource/static}/swagger-ui/favicon-32x32.png +0 -0
- /arpakitlib/{ar_fastapi_static → _arpakit_project_template_v_1/resource/static}/swagger-ui/index.css +0 -0
- /arpakitlib/{ar_fastapi_static → _arpakit_project_template_v_1/resource/static}/swagger-ui/oauth2-redirect.html +0 -0
- /arpakitlib/{ar_fastapi_static → _arpakit_project_template_v_1/resource/static}/swagger-ui/swagger-initializer.js +0 -0
- /arpakitlib/{ar_fastapi_static → _arpakit_project_template_v_1/resource/static}/swagger-ui/swagger-ui-bundle.js.map +0 -0
- /arpakitlib/{ar_fastapi_static → _arpakit_project_template_v_1/resource/static}/swagger-ui/swagger-ui-es-bundle.js.map +0 -0
- /arpakitlib/{ar_fastapi_static → _arpakit_project_template_v_1/resource/static}/swagger-ui/swagger-ui-standalone-preset.js.map +0 -0
- /arpakitlib/{ar_fastapi_static → _arpakit_project_template_v_1/resource/static}/swagger-ui/swagger-ui.css +0 -0
- /arpakitlib/{ar_fastapi_static → _arpakit_project_template_v_1/resource/static}/swagger-ui/swagger-ui.css.map +0 -0
- /arpakitlib/{_arpakit_project_template/src → _arpakit_project_template_v_1}/sandbox/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template/src/sqlalchemy_db → _arpakit_project_template_v_1/site}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template/src/test_data/__init__.py → _arpakit_project_template_v_1/site/asgi.py} +0 -0
- /arpakitlib/{_arpakit_project_template/src/tg_bot/__init__.py → _arpakit_project_template_v_1/site/consts.py} +0 -0
- /arpakitlib/{_arpakit_project_template/src/tg_bot/blank/__init__.py → _arpakit_project_template_v_1/site/create_site_app.py} +0 -0
- /arpakitlib/{_arpakit_project_template/src/tg_bot/filter/__init__.py → _arpakit_project_template_v_1/site/event.py} +0 -0
- /arpakitlib/{_arpakit_project_template/src/tg_bot/handler/__init__.py → _arpakit_project_template_v_1/site/exception_handler.py} +0 -0
- /arpakitlib/{_arpakit_project_template/src/tg_bot/kb → _arpakit_project_template_v_1/site/router}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template/src/tg_bot/kb/inline_ → _arpakit_project_template_v_1/sqladmin_}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template/src/tg_bot/kb/static_ → _arpakit_project_template_v_1/sqlalchemy_db}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template/src → _arpakit_project_template_v_1}/sqlalchemy_db/const.py +0 -0
- /arpakitlib/{_arpakit_project_template/src/tg_bot/middleware → _arpakit_project_template_v_1/test_data}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template/src/tg_bot/router → _arpakit_project_template_v_1/tg_bot}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template/src/util → _arpakit_project_template_v_1/tg_bot/blank}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template/src/tg_bot/handler/cmd_arpakitlib.py → _arpakit_project_template_v_1/tg_bot/filter/__init__.py} +0 -0
- /arpakitlib/{_arpakit_project_template/src/tg_bot/handler/cmd_healthcheck.py → _arpakit_project_template_v_1/tg_bot/kb/__init__.py} +0 -0
- /arpakitlib/{_arpakit_project_template/src/tg_bot/kb/inline_/callback.py → _arpakit_project_template_v_1/tg_bot/kb/inline_/__init__.py} +0 -0
- /arpakitlib/{_arpakit_project_template/src/tg_bot/kb/inline_/common.py → _arpakit_project_template_v_1/tg_bot/kb/inline_/callback.py} +0 -0
- /arpakitlib/{_arpakit_project_template/src/tg_bot/kb/static_ → _arpakit_project_template_v_1/tg_bot/kb/inline_}/common.py +0 -0
- {arpakitlib-1.7.257.dist-info → arpakitlib-1.8.1.dist-info}/LICENSE +0 -0
- {arpakitlib-1.7.257.dist-info → arpakitlib-1.8.1.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,24 @@
|
|
1
|
+
from fastapi import FastAPI
|
2
|
+
from sqladmin import Admin
|
3
|
+
|
4
|
+
from core.settings import get_cached_settings
|
5
|
+
from sqladmin_.admin_auth import SQLAdminAuth
|
6
|
+
from sqladmin_.model_view import get_simple_mv
|
7
|
+
from sqlalchemy_db.sqlalchemy_db import get_cached_sqlalchemy_db
|
8
|
+
|
9
|
+
|
10
|
+
def add_sqladmin_in_app(*, app: FastAPI, base_url: str = "sqladmin") -> FastAPI:
|
11
|
+
authentication_backend = SQLAdminAuth()
|
12
|
+
|
13
|
+
admin = Admin(
|
14
|
+
app=app,
|
15
|
+
engine=get_cached_sqlalchemy_db().engine,
|
16
|
+
base_url=base_url,
|
17
|
+
authentication_backend=authentication_backend,
|
18
|
+
title=get_cached_settings().project_name
|
19
|
+
)
|
20
|
+
|
21
|
+
for model_view in get_simple_mv().__subclasses__():
|
22
|
+
admin.add_model_view(model_view)
|
23
|
+
|
24
|
+
return app
|
@@ -0,0 +1,54 @@
|
|
1
|
+
import logging
|
2
|
+
|
3
|
+
import fastapi
|
4
|
+
from sqladmin.authentication import AuthenticationBackend
|
5
|
+
|
6
|
+
from core.settings import get_cached_settings
|
7
|
+
|
8
|
+
|
9
|
+
class SQLAdminAuth(AuthenticationBackend):
|
10
|
+
def __init__(self):
|
11
|
+
self._logger = logging.getLogger(self.__class__.__name__)
|
12
|
+
super().__init__(secret_key=get_cached_settings().sqladmin_secret_key)
|
13
|
+
|
14
|
+
async def login(self, request: fastapi.Request) -> bool:
|
15
|
+
form = await request.form()
|
16
|
+
username, password = form.get("username"), form.get("password")
|
17
|
+
if username:
|
18
|
+
username = username.strip()
|
19
|
+
if password:
|
20
|
+
password = password.strip()
|
21
|
+
|
22
|
+
if get_cached_settings().sqladmin_correct_passwords is None:
|
23
|
+
return False
|
24
|
+
if (
|
25
|
+
(username is not None and username in get_cached_settings().sqladmin_correct_passwords)
|
26
|
+
or
|
27
|
+
(password is not None and password in get_cached_settings().sqladmin_correct_passwords)
|
28
|
+
):
|
29
|
+
return True
|
30
|
+
|
31
|
+
return False
|
32
|
+
|
33
|
+
async def logout(self, request: fastapi.Request) -> bool:
|
34
|
+
request.session.clear()
|
35
|
+
return True
|
36
|
+
|
37
|
+
async def authenticate(self, request: fastapi.Request) -> bool:
|
38
|
+
form = await request.form()
|
39
|
+
username, password = form.get("username"), form.get("password")
|
40
|
+
if username:
|
41
|
+
username = username.strip()
|
42
|
+
if password:
|
43
|
+
password = password.strip()
|
44
|
+
|
45
|
+
if get_cached_settings().sqladmin_correct_passwords is None:
|
46
|
+
return False
|
47
|
+
if (
|
48
|
+
(username is not None and username in get_cached_settings().sqladmin_correct_passwords)
|
49
|
+
or
|
50
|
+
(password is not None and password in get_cached_settings().sqladmin_correct_passwords)
|
51
|
+
):
|
52
|
+
return True
|
53
|
+
|
54
|
+
return False
|
@@ -0,0 +1,95 @@
|
|
1
|
+
from sqladmin import ModelView
|
2
|
+
|
3
|
+
from arpakitlib.ar_sqladmin_util import get_string_info_from_model_view
|
4
|
+
from sqlalchemy_db.sqlalchemy_model import StoryLogDBM, OperationDBM
|
5
|
+
|
6
|
+
|
7
|
+
class SimpleMV(ModelView):
|
8
|
+
can_create = True
|
9
|
+
can_edit = True
|
10
|
+
can_delete = True
|
11
|
+
can_view_details = True
|
12
|
+
can_export = True
|
13
|
+
page_size = 50
|
14
|
+
page_size_options = [50, 100, 200]
|
15
|
+
save_as = True
|
16
|
+
save_as_continue = True
|
17
|
+
export_types = ["xlsx", "csv", "json"]
|
18
|
+
|
19
|
+
|
20
|
+
class StoryLogMV(SimpleMV, model=StoryLogDBM):
|
21
|
+
name = "StoryLog"
|
22
|
+
name_plural = "StoryLogs"
|
23
|
+
column_list = [
|
24
|
+
StoryLogDBM.id,
|
25
|
+
StoryLogDBM.long_id,
|
26
|
+
StoryLogDBM.creation_dt,
|
27
|
+
StoryLogDBM.level,
|
28
|
+
StoryLogDBM.type,
|
29
|
+
StoryLogDBM.title,
|
30
|
+
StoryLogDBM.data
|
31
|
+
]
|
32
|
+
form_columns = [
|
33
|
+
StoryLogDBM.level,
|
34
|
+
StoryLogDBM.type,
|
35
|
+
StoryLogDBM.title,
|
36
|
+
StoryLogDBM.data
|
37
|
+
]
|
38
|
+
column_default_sort = [
|
39
|
+
(StoryLogDBM.creation_dt, True)
|
40
|
+
]
|
41
|
+
column_searchable_list = [
|
42
|
+
StoryLogDBM.id,
|
43
|
+
StoryLogDBM.long_id,
|
44
|
+
StoryLogDBM.level,
|
45
|
+
StoryLogDBM.type,
|
46
|
+
StoryLogDBM.title,
|
47
|
+
StoryLogDBM.data
|
48
|
+
]
|
49
|
+
|
50
|
+
|
51
|
+
class OperationMV(SimpleMV, model=OperationDBM):
|
52
|
+
name = "Operation"
|
53
|
+
name_plural = "Operations"
|
54
|
+
column_list = [
|
55
|
+
OperationDBM.id,
|
56
|
+
OperationDBM.long_id,
|
57
|
+
OperationDBM.creation_dt,
|
58
|
+
OperationDBM.status,
|
59
|
+
OperationDBM.type,
|
60
|
+
OperationDBM.execution_start_dt,
|
61
|
+
OperationDBM.execution_finish_dt,
|
62
|
+
OperationDBM.input_data,
|
63
|
+
OperationDBM.output_data,
|
64
|
+
OperationDBM.error_data
|
65
|
+
]
|
66
|
+
form_columns = [
|
67
|
+
OperationDBM.status,
|
68
|
+
OperationDBM.type,
|
69
|
+
OperationDBM.execution_start_dt,
|
70
|
+
OperationDBM.execution_finish_dt,
|
71
|
+
OperationDBM.input_data,
|
72
|
+
OperationDBM.output_data,
|
73
|
+
OperationDBM.error_data
|
74
|
+
]
|
75
|
+
column_default_sort = [
|
76
|
+
(OperationDBM.creation_dt, True)
|
77
|
+
]
|
78
|
+
column_searchable_list = [
|
79
|
+
OperationDBM.id,
|
80
|
+
OperationDBM.long_id,
|
81
|
+
OperationDBM.status,
|
82
|
+
OperationDBM.type,
|
83
|
+
]
|
84
|
+
|
85
|
+
|
86
|
+
def get_simple_mv() -> type[SimpleMV]:
|
87
|
+
return SimpleMV
|
88
|
+
|
89
|
+
|
90
|
+
def import_sqladmin_model_views():
|
91
|
+
pass
|
92
|
+
|
93
|
+
|
94
|
+
if __name__ == '__main__':
|
95
|
+
print(get_string_info_from_model_view(class_=SimpleMV))
|
@@ -0,0 +1,22 @@
|
|
1
|
+
from functools import lru_cache
|
2
|
+
|
3
|
+
from arpakitlib.ar_sqlalchemy_util import SQLAlchemyDb
|
4
|
+
from core.settings import get_cached_settings
|
5
|
+
from sqlalchemy_db.sqlalchemy_model import get_simple_dbm
|
6
|
+
|
7
|
+
|
8
|
+
def create_sqlalchemy_db() -> SQLAlchemyDb | None:
|
9
|
+
if not get_cached_settings().sqlalchemy_sync_db_url or not get_cached_settings().sqlalchemy_async_db_url:
|
10
|
+
return None
|
11
|
+
|
12
|
+
return SQLAlchemyDb(
|
13
|
+
sync_db_url=get_cached_settings().sqlalchemy_sync_db_url,
|
14
|
+
async_db_url=get_cached_settings().sqlalchemy_async_db_url,
|
15
|
+
db_echo=get_cached_settings().sqlalchemy_db_echo,
|
16
|
+
base_dbm=get_simple_dbm()
|
17
|
+
)
|
18
|
+
|
19
|
+
|
20
|
+
@lru_cache()
|
21
|
+
def get_cached_sqlalchemy_db() -> SQLAlchemyDb | None:
|
22
|
+
return create_sqlalchemy_db()
|
@@ -0,0 +1,129 @@
|
|
1
|
+
from datetime import datetime, timedelta
|
2
|
+
from typing import Any
|
3
|
+
|
4
|
+
import sqlalchemy
|
5
|
+
from sqlalchemy import func
|
6
|
+
from sqlalchemy.dialects import postgresql
|
7
|
+
from sqlalchemy.orm import mapped_column, Mapped
|
8
|
+
|
9
|
+
from arpakitlib.ar_datetime_util import now_utc_dt
|
10
|
+
from arpakitlib.ar_enumeration_util import Enumeration
|
11
|
+
from arpakitlib.ar_sqlalchemy_util import get_string_info_from_declarative_base, BaseDBM
|
12
|
+
from sqlalchemy_db.util import generate_default_long_id
|
13
|
+
|
14
|
+
|
15
|
+
class SimpleDBM(BaseDBM):
|
16
|
+
__abstract__ = True
|
17
|
+
|
18
|
+
id: Mapped[int] = mapped_column(
|
19
|
+
sqlalchemy.INTEGER, primary_key=True, autoincrement=True, sort_order=-3, nullable=False
|
20
|
+
)
|
21
|
+
long_id: Mapped[str] = mapped_column(
|
22
|
+
sqlalchemy.TEXT, insert_default=generate_default_long_id, server_default=func.gen_random_uuid(),
|
23
|
+
unique=True, sort_order=-2, nullable=False
|
24
|
+
)
|
25
|
+
creation_dt: Mapped[datetime] = mapped_column(
|
26
|
+
sqlalchemy.TIMESTAMP(timezone=True), insert_default=now_utc_dt, server_default=func.now(),
|
27
|
+
index=True, sort_order=-1, nullable=False
|
28
|
+
)
|
29
|
+
|
30
|
+
def __repr__(self):
|
31
|
+
return f"{self.__class__.__name__.removesuffix('DBM')} (id={self.id})"
|
32
|
+
|
33
|
+
|
34
|
+
class StoryLogDBM(SimpleDBM):
|
35
|
+
__tablename__ = "story_log"
|
36
|
+
|
37
|
+
class Levels(Enumeration):
|
38
|
+
info = "info"
|
39
|
+
warning = "warning"
|
40
|
+
error = "error"
|
41
|
+
|
42
|
+
class Types(Enumeration):
|
43
|
+
error_in_execute_operation = "error_in_execute_operation"
|
44
|
+
error_in_api_route = "error_in_api_route"
|
45
|
+
|
46
|
+
level: Mapped[str] = mapped_column(
|
47
|
+
sqlalchemy.TEXT, insert_default=Levels.info, server_default=Levels.info, index=True, nullable=False
|
48
|
+
)
|
49
|
+
type: Mapped[str | None] = mapped_column(sqlalchemy.TEXT, index=True, default=None, nullable=True)
|
50
|
+
title: Mapped[str | None] = mapped_column(sqlalchemy.TEXT, index=True, default=None, nullable=True)
|
51
|
+
data: Mapped[dict[str, Any]] = mapped_column(
|
52
|
+
postgresql.JSON, insert_default={}, server_default="{}", nullable=False
|
53
|
+
)
|
54
|
+
|
55
|
+
|
56
|
+
class OperationDBM(SimpleDBM):
|
57
|
+
__tablename__ = "operation"
|
58
|
+
|
59
|
+
class Statuses(Enumeration):
|
60
|
+
waiting_for_execution = "waiting_for_execution"
|
61
|
+
executing = "executing"
|
62
|
+
executed_without_error = "executed_without_error"
|
63
|
+
executed_with_error = "executed_with_error"
|
64
|
+
|
65
|
+
class Types(Enumeration):
|
66
|
+
healthcheck_ = "healthcheck"
|
67
|
+
raise_fake_error_ = "raise_fake_error_"
|
68
|
+
|
69
|
+
status: Mapped[str] = mapped_column(
|
70
|
+
sqlalchemy.TEXT, index=True, insert_default=Statuses.waiting_for_execution,
|
71
|
+
server_default=Statuses.waiting_for_execution, nullable=False
|
72
|
+
)
|
73
|
+
type: Mapped[str] = mapped_column(
|
74
|
+
sqlalchemy.TEXT, index=True, insert_default=Types.healthcheck_, nullable=False
|
75
|
+
)
|
76
|
+
execution_start_dt: Mapped[datetime | None] = mapped_column(sqlalchemy.TIMESTAMP(timezone=True), nullable=True)
|
77
|
+
execution_finish_dt: Mapped[datetime | None] = mapped_column(sqlalchemy.TIMESTAMP(timezone=True), nullable=True)
|
78
|
+
input_data: Mapped[dict[str, Any]] = mapped_column(
|
79
|
+
postgresql.JSON,
|
80
|
+
insert_default={},
|
81
|
+
server_default="{}",
|
82
|
+
nullable=False
|
83
|
+
)
|
84
|
+
output_data: Mapped[dict[str, Any]] = mapped_column(
|
85
|
+
postgresql.JSON, insert_default={}, server_default="{}", nullable=False
|
86
|
+
)
|
87
|
+
error_data: Mapped[dict[str, Any]] = mapped_column(
|
88
|
+
postgresql.JSON, insert_default={}, server_default="{}", nullable=False
|
89
|
+
)
|
90
|
+
|
91
|
+
def raise_if_executed_with_error(self):
|
92
|
+
if self.status == self.Statuses.executed_with_error:
|
93
|
+
raise Exception(
|
94
|
+
f"Operation (id={self.id}, type={self.type}) executed with error, error_data={self.error_data}"
|
95
|
+
)
|
96
|
+
|
97
|
+
def raise_if_error_data(self):
|
98
|
+
if self.error_data:
|
99
|
+
raise Exception(
|
100
|
+
f"Operation (id={self.id}, type={self.type}) has error_data, error_data={self.error_data}"
|
101
|
+
)
|
102
|
+
|
103
|
+
@property
|
104
|
+
def duration(self) -> timedelta | None:
|
105
|
+
if self.execution_start_dt is None or self.execution_finish_dt is None:
|
106
|
+
return None
|
107
|
+
return self.execution_finish_dt - self.execution_start_dt
|
108
|
+
|
109
|
+
@property
|
110
|
+
def duration_total_seconds(self) -> float | None:
|
111
|
+
if self.duration is None:
|
112
|
+
return None
|
113
|
+
return self.duration.total_seconds()
|
114
|
+
|
115
|
+
@property
|
116
|
+
def sdp_duration_total_seconds(self) -> float | None:
|
117
|
+
return self.duration_total_seconds
|
118
|
+
|
119
|
+
|
120
|
+
def get_simple_dbm() -> type[SimpleDBM]:
|
121
|
+
return SimpleDBM
|
122
|
+
|
123
|
+
|
124
|
+
def import_sqlalchemy_models():
|
125
|
+
pass
|
126
|
+
|
127
|
+
|
128
|
+
if __name__ == '__main__':
|
129
|
+
print(get_string_info_from_declarative_base(SimpleDBM))
|
@@ -0,0 +1,28 @@
|
|
1
|
+
from uuid import uuid4
|
2
|
+
|
3
|
+
from arpakitlib.ar_datetime_util import now_utc_dt
|
4
|
+
|
5
|
+
|
6
|
+
def generate_api_key() -> str:
|
7
|
+
return (
|
8
|
+
f"apikey"
|
9
|
+
f"{str(uuid4()).replace('-', '')}"
|
10
|
+
f"{str(now_utc_dt().timestamp()).replace('.', '')}"
|
11
|
+
)
|
12
|
+
|
13
|
+
|
14
|
+
def generate_default_long_id():
|
15
|
+
return (
|
16
|
+
f"longid"
|
17
|
+
f"{str(uuid4()).replace('-', '')}"
|
18
|
+
f"{str(now_utc_dt().timestamp()).replace('.', '')}"
|
19
|
+
)
|
20
|
+
|
21
|
+
|
22
|
+
def __example():
|
23
|
+
print(generate_api_key())
|
24
|
+
print(generate_default_long_id())
|
25
|
+
|
26
|
+
|
27
|
+
if __name__ == '__main__':
|
28
|
+
__example()
|
@@ -1,15 +1,20 @@
|
|
1
1
|
import asyncio
|
2
2
|
|
3
3
|
|
4
|
-
|
4
|
+
def make_test_data_1():
|
5
|
+
pass
|
5
6
|
|
6
7
|
|
7
|
-
def
|
8
|
+
async def async_make_test_data_1():
|
8
9
|
pass
|
9
10
|
|
10
11
|
|
12
|
+
def __example():
|
13
|
+
make_test_data_1()
|
14
|
+
|
15
|
+
|
11
16
|
async def __async_example():
|
12
|
-
|
17
|
+
await async_make_test_data_1()
|
13
18
|
|
14
19
|
|
15
20
|
if __name__ == '__main__':
|
@@ -1,15 +1,20 @@
|
|
1
1
|
import asyncio
|
2
2
|
|
3
3
|
|
4
|
-
|
4
|
+
def make_test_data_2():
|
5
|
+
pass
|
5
6
|
|
6
7
|
|
7
|
-
def
|
8
|
+
async def async_make_test_data_2():
|
8
9
|
pass
|
9
10
|
|
10
11
|
|
12
|
+
def __example():
|
13
|
+
make_test_data_2()
|
14
|
+
|
15
|
+
|
11
16
|
async def __async_example():
|
12
|
-
|
17
|
+
await async_make_test_data_2()
|
13
18
|
|
14
19
|
|
15
20
|
if __name__ == '__main__':
|
@@ -1,15 +1,20 @@
|
|
1
1
|
import asyncio
|
2
2
|
|
3
3
|
|
4
|
-
|
4
|
+
def make_test_data_3():
|
5
|
+
pass
|
5
6
|
|
6
7
|
|
7
|
-
def
|
8
|
+
async def async_make_test_data_3():
|
8
9
|
pass
|
9
10
|
|
10
11
|
|
12
|
+
def __example():
|
13
|
+
make_test_data_3()
|
14
|
+
|
15
|
+
|
11
16
|
async def __async_example():
|
12
|
-
|
17
|
+
await async_make_test_data_3()
|
13
18
|
|
14
19
|
|
15
20
|
if __name__ == '__main__':
|
@@ -1,15 +1,20 @@
|
|
1
1
|
import asyncio
|
2
2
|
|
3
3
|
|
4
|
-
|
4
|
+
def make_test_data_4():
|
5
|
+
pass
|
5
6
|
|
6
7
|
|
7
|
-
def
|
8
|
+
async def async_make_test_data_4():
|
8
9
|
pass
|
9
10
|
|
10
11
|
|
12
|
+
def __example():
|
13
|
+
make_test_data_4()
|
14
|
+
|
15
|
+
|
11
16
|
async def __async_example():
|
12
|
-
|
17
|
+
await async_make_test_data_4()
|
13
18
|
|
14
19
|
|
15
20
|
if __name__ == '__main__':
|
@@ -0,0 +1,22 @@
|
|
1
|
+
import asyncio
|
2
|
+
|
3
|
+
|
4
|
+
def make_test_data_5():
|
5
|
+
pass
|
6
|
+
|
7
|
+
|
8
|
+
async def async_make_test_data_5():
|
9
|
+
pass
|
10
|
+
|
11
|
+
|
12
|
+
def __example():
|
13
|
+
make_test_data_5()
|
14
|
+
|
15
|
+
|
16
|
+
async def __async_example():
|
17
|
+
await async_make_test_data_5()
|
18
|
+
|
19
|
+
|
20
|
+
if __name__ == '__main__':
|
21
|
+
__example()
|
22
|
+
asyncio.run(__async_example())
|
@@ -1,11 +1,14 @@
|
|
1
1
|
from arpakitlib.ar_enumeration_util import Enumeration
|
2
2
|
|
3
3
|
|
4
|
-
class
|
4
|
+
class TgBotCommands(Enumeration):
|
5
|
+
# public
|
6
|
+
healthcheck = "healthcheck"
|
7
|
+
arpakitlib = "arpakitlib"
|
5
8
|
start = "start"
|
9
|
+
about = "about"
|
6
10
|
|
7
|
-
|
8
|
-
class TgBotPrivateCommands(Enumeration):
|
11
|
+
# private
|
9
12
|
init_db = "init_db"
|
10
13
|
reinit_db = "reinit_db"
|
11
14
|
drop_db = "drop_db"
|
@@ -0,0 +1,51 @@
|
|
1
|
+
import logging
|
2
|
+
from typing import Callable
|
3
|
+
|
4
|
+
from aiogram import Dispatcher
|
5
|
+
|
6
|
+
from tg_bot.transmitted_tg_data import get_cached_transmitted_tg_bot_data
|
7
|
+
|
8
|
+
_logger = logging.getLogger(__name__)
|
9
|
+
|
10
|
+
|
11
|
+
async def on_startup():
|
12
|
+
_logger.info("start")
|
13
|
+
|
14
|
+
if get_cached_transmitted_tg_bot_data().media_file_storage_in_dir is not None:
|
15
|
+
get_cached_transmitted_tg_bot_data().media_file_storage_in_dir.init()
|
16
|
+
|
17
|
+
if get_cached_transmitted_tg_bot_data().cache_file_storage_in_dir is not None:
|
18
|
+
get_cached_transmitted_tg_bot_data().cache_file_storage_in_dir.init()
|
19
|
+
|
20
|
+
if get_cached_transmitted_tg_bot_data().dump_file_storage_in_dir is not None:
|
21
|
+
get_cached_transmitted_tg_bot_data().dump_file_storage_in_dir.init()
|
22
|
+
|
23
|
+
if get_cached_transmitted_tg_bot_data().settings.api_init_sqlalchemy_db:
|
24
|
+
get_cached_transmitted_tg_bot_data().sqlalchemy_db.init()
|
25
|
+
|
26
|
+
if get_cached_transmitted_tg_bot_data().settings.api_init_json_db:
|
27
|
+
get_cached_transmitted_tg_bot_data().json_db.init()
|
28
|
+
|
29
|
+
_logger.info("finish")
|
30
|
+
|
31
|
+
|
32
|
+
async def on_shutdown(*args, **kwargs):
|
33
|
+
_logger.info("start")
|
34
|
+
_logger.info("finish")
|
35
|
+
|
36
|
+
|
37
|
+
def get_tg_bot_startup_events() -> list[Callable]:
|
38
|
+
res = [on_startup]
|
39
|
+
return res
|
40
|
+
|
41
|
+
|
42
|
+
def get_tg_bot_shutdown_events() -> list[Callable]:
|
43
|
+
res = [on_shutdown]
|
44
|
+
return res
|
45
|
+
|
46
|
+
|
47
|
+
def add_events_to_tg_bot_dispatcher(*, tg_bot_dispatcher: Dispatcher):
|
48
|
+
for tg_bot_event in get_tg_bot_startup_events():
|
49
|
+
tg_bot_dispatcher.startup.register(tg_bot_event)
|
50
|
+
for tg_bot_event in get_tg_bot_shutdown_events():
|
51
|
+
tg_bot_dispatcher.shutdown.register(tg_bot_event)
|