arpakitlib 1.8.0__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_v1 → _arpakit_project_template_v_1}/api/auth.py +17 -26
- arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/api/create_api_app.py +22 -23
- arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/api/event.py +20 -15
- arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/api/exception.py +1 -2
- arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/api/exception_handler.py +47 -36
- arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/api/response.py +7 -3
- arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/api/router/main_router.py +1 -1
- arpakitlib/_arpakit_project_template_v_1/api/router/v1/arpakit_project_template.py +22 -0
- arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/api/router/v1/check_auth.py +7 -7
- arpakitlib/_arpakit_project_template_v_1/api/router/v1/clear_log_file.py +25 -0
- arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/api/router/v1/get_errors_info.py +2 -2
- arpakitlib/_arpakit_project_template_v_1/api/router/v1/get_log_file.py +23 -0
- arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/api/router/v1/healthcheck.py +2 -2
- arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/api/router/v1/main_router.py +16 -3
- arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/api/router/v1/now_utc_datetime.py +2 -2
- arpakitlib/_arpakit_project_template_v_1/api/router/v1/raise_fake_error.py +35 -0
- arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/api/schema/v1/out.py +0 -6
- arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/command/drop_json_db.py +2 -2
- arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/command/init_json_db.py +2 -2
- arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/command/reinit_json_db.py +2 -2
- arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/command/rm_all_records_in_json_db.py +2 -2
- arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/core/cache_file_storage_in_dir.py +4 -2
- arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/core/const.py +5 -6
- arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/core/dump_file_storage_in_dir.py +4 -2
- arpakitlib/_arpakit_project_template_v_1/core/jinja2_templates.py +14 -0
- arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/core/media_file_storage_in_dir.py +4 -2
- arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/core/settings.py +7 -5
- arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/example.env +3 -2
- arpakitlib/_arpakit_project_template_v_1/json_db/json_db.py +28 -0
- arpakitlib/_arpakit_project_template_v_1/resource/static/healthcheck +1 -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_v1 → _arpakit_project_template_v_1}/sqlalchemy_db/sqlalchemy_db.py +5 -2
- arpakitlib/_arpakit_project_template_v_1/tg_bot/kb/inline_/common.py +0 -0
- 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/router/__init__.py +0 -0
- arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/tg_bot/transmitted_tg_data.py +2 -2
- arpakitlib/_arpakit_project_template_v_1/tg_bot/util.py +0 -0
- arpakitlib/_arpakit_project_template_v_1/util/__init__.py +0 -0
- arpakitlib/ar_arpakit_project_template_util.py +1 -1
- {arpakitlib-1.8.0.dist-info → arpakitlib-1.8.1.dist-info}/METADATA +1 -1
- arpakitlib-1.8.1.dist-info/RECORD +261 -0
- arpakitlib/_arpakit_project_template_v1/admin1/add_admin_in_app.py +0 -26
- arpakitlib/_arpakit_project_template_v1/admin1/admin_auth.py +0 -25
- arpakitlib/_arpakit_project_template_v1/api/router/v1/arpakitlib_.py +0 -27
- arpakitlib/_arpakit_project_template_v1/api/router/v1/raise_fake_error.py +0 -21
- arpakitlib/_arpakit_project_template_v1/api/transmitted_api_data.py +0 -66
- arpakitlib/_arpakit_project_template_v1/json_db/json_db.py +0 -11
- arpakitlib/_arpakit_project_template_v1/json_db/util.py +0 -17
- arpakitlib-1.8.0.dist-info/RECORD +0 -251
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/.gitignore +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/.python-version +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/LICENSE +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/README.md +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/additional_model/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/additional_model/additional_model.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/alembic/README +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/alembic/env.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/alembic/script.py.mako +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/alembic.ini +0 -0
- /arpakitlib/{_arpakit_project_template_v1/admin1 → _arpakit_project_template_v_1/api}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/api/asgi.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/api/const.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/api/openapi_ui.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1/api → _arpakit_project_template_v_1/api/router}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1/api/router → _arpakit_project_template_v_1/api/router/v1}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1/api/router/v1 → _arpakit_project_template_v_1/api/schema}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/api/schema/base_schema.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1/api/schema → _arpakit_project_template_v_1/api/schema/common}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/api/schema/common/in_.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/api/schema/common/out.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1/api/schema/common → _arpakit_project_template_v_1/api/schema/v1}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/api/schema/v1/in_.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/api/util.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/arpakitlib_project_template.json +0 -0
- /arpakitlib/{_arpakit_project_template_v1/api/schema/v1 → _arpakit_project_template_v_1/business_service}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/business_service/hello_world.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/business_service/remove_operations.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1/business_service → _arpakit_project_template_v_1/celery_}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/command/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/command/alembic_history.sh +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/command/alembic_revision_autogenerate.sh +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/command/alembic_upgrade_head .sh +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/command/beautify_json.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/command/check_logging.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/command/check_sqlalchemy_db.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/command/docker_ps_a.sh +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/command/docker_rm_postgres.sh +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/command/docker_run_postgres.sh +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/command/docker_start_postgres.sh +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/command/docker_stop_postgres.sh +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/command/drop_sqlalchemy_db.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/command/generate_settings_env_example.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/command/git_commit.sh +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/command/git_push_arpakit_company_github_1.sh +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/command/git_push_arpakit_company_gitlab_1.sh +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/command/git_push_arpakit_github_1.sh +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/command/git_push_arpakit_gitlab_1.sh +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/command/git_remote.sh +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/command/git_set_arpakit_company_origin.sh +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/command/git_set_arpakit_origin.sh +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/command/git_status.sh +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/command/hello_world.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/command/init_sqlalchemy_db.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/command/poetry_check.sh +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/command/poetry_clear_cache.sh +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/command/poetry_config.sh +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/command/poetry_install.sh +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/command/poetry_lock.sh +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/command/poetry_remove_and_add_arpakitlib.sh +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/command/poetry_show.sh +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/command/poetry_show_arpakitlib.sh +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/command/poetry_update.sh +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/command/poetry_update_arpakitlib.sh +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/command/reinit_sqlalchemy_db.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/command/remove_operations.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/command/remove_story_logs.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/command/show_settings.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/command/start_api_with_reload.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/command/start_api_without_reload.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/command/start_async_operation_executor_worker.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/command/start_async_scheduled_operation_creator_worker.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/command/start_sync_operation_executor_worker.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/command/start_sync_operation_executor_workers.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/command/start_sync_scheduled_operation_creator_worker.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/core/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/core/util.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/json_db/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/note/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/note/note_1.txt +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/note/note_2.txt +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/note/note_3.txt +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/note/note_4.txt +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/note/note_5.txt +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/operation_execution/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/operation_execution/const.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/operation_execution/operation_executor_worker.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/operation_execution/scheduled_operation_creator_worker.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/operation_execution/scheduled_operations.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/operation_execution/util.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/resource/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1/resource/static/healthcheck → _arpakit_project_template_v_1/resource/static/1} +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/resource/static/helloworld +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/resource/static/openapi-favicon.png +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/resource/static/redoc/redoc.standalone.js +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/resource/static/swagger-ui/favicon-16x16.png +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/resource/static/swagger-ui/favicon-32x32.png +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/resource/static/swagger-ui/index.css +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/resource/static/swagger-ui/index.html +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/resource/static/swagger-ui/oauth2-redirect.html +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/resource/static/swagger-ui/swagger-initializer.js +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/resource/static/swagger-ui/swagger-ui-bundle.js +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/resource/static/swagger-ui/swagger-ui-bundle.js.map +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/resource/static/swagger-ui/swagger-ui-es-bundle-core.js +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/resource/static/swagger-ui/swagger-ui-es-bundle-core.js.map +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/resource/static/swagger-ui/swagger-ui-es-bundle.js +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/resource/static/swagger-ui/swagger-ui-es-bundle.js.map +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/resource/static/swagger-ui/swagger-ui-standalone-preset.js +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/resource/static/swagger-ui/swagger-ui-standalone-preset.js.map +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/resource/static/swagger-ui/swagger-ui.css +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/resource/static/swagger-ui/swagger-ui.css.map +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/resource/static/swagger-ui/swagger-ui.js +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/resource/static/swagger-ui/swagger-ui.js.map +0 -0
- /arpakitlib/{_arpakit_project_template_v1/resource/static → _arpakit_project_template_v_1/sandbox}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/sandbox/sandbox_1.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/sandbox/sandbox_2.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/sandbox/sandbox_3.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/sandbox/sandbox_4.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/sandbox/sandbox_5.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/sandbox/sandbox_6.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/sandbox/sandbox_7.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1/sandbox → _arpakit_project_template_v_1/site}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1/sqlalchemy_db/__init__.py → _arpakit_project_template_v_1/site/asgi.py} +0 -0
- /arpakitlib/{_arpakit_project_template_v1/test_data/__init__.py → _arpakit_project_template_v_1/site/consts.py} +0 -0
- /arpakitlib/{_arpakit_project_template_v1/tg_bot/__init__.py → _arpakit_project_template_v_1/site/create_site_app.py} +0 -0
- /arpakitlib/{_arpakit_project_template_v1/tg_bot/blank/__init__.py → _arpakit_project_template_v_1/site/event.py} +0 -0
- /arpakitlib/{_arpakit_project_template_v1/tg_bot/filter/__init__.py → _arpakit_project_template_v_1/site/exception_handler.py} +0 -0
- /arpakitlib/{_arpakit_project_template_v1/tg_bot/kb → _arpakit_project_template_v_1/site/router}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1/tg_bot/kb/inline_ → _arpakit_project_template_v_1/sqladmin_}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1/admin1 → _arpakit_project_template_v_1/sqladmin_}/model_view.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1/tg_bot/kb/static_ → _arpakit_project_template_v_1/sqlalchemy_db}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/sqlalchemy_db/const.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/sqlalchemy_db/sqlalchemy_model.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/sqlalchemy_db/util.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1/tg_bot/middleware → _arpakit_project_template_v_1/test_data}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/test_data/make_test_data_1.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/test_data/make_test_data_2.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/test_data/make_test_data_3.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/test_data/make_test_data_4.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/test_data/make_test_data_5.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1/tg_bot/router → _arpakit_project_template_v_1/tg_bot}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1/util → _arpakit_project_template_v_1/tg_bot/blank}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/tg_bot/blank/blank.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/tg_bot/blank/util.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/tg_bot/const.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/tg_bot/event.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1/tg_bot/kb/inline_/callback.py → _arpakit_project_template_v_1/tg_bot/filter/__init__.py} +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/tg_bot/filter/not_prod_mode.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/tg_bot/filter/prod_mode.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1/tg_bot/kb/inline_/common.py → _arpakit_project_template_v_1/tg_bot/kb/__init__.py} +0 -0
- /arpakitlib/{_arpakit_project_template_v1/tg_bot/kb/static_/common.py → _arpakit_project_template_v_1/tg_bot/kb/inline_/__init__.py} +0 -0
- /arpakitlib/{_arpakit_project_template_v1/tg_bot/util.py → _arpakit_project_template_v_1/tg_bot/kb/inline_/callback.py} +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/tg_bot/middleware/init_user.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/tg_bot/middleware/middleware.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/tg_bot/router/arpakitlib_.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/tg_bot/router/error.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/tg_bot/router/healthcheck.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/tg_bot/router/main_router.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/tg_bot/start_tg_bot.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/tg_bot/tg_bot.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/tg_bot/tg_bot_dispatcher.py +0 -0
- /arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/util/read_arpakitlib_project_template_file.py +0 -0
- {arpakitlib-1.8.0.dist-info → arpakitlib-1.8.1.dist-info}/LICENSE +0 -0
- {arpakitlib-1.8.0.dist-info → arpakitlib-1.8.1.dist-info}/WHEEL +0 -0
- {arpakitlib-1.8.0.dist-info → arpakitlib-1.8.1.dist-info}/entry_points.txt +0 -0
@@ -4,20 +4,16 @@ import fastapi
|
|
4
4
|
import fastapi.exceptions
|
5
5
|
import fastapi.responses
|
6
6
|
import fastapi.security
|
7
|
-
import
|
8
|
-
import starlette.requests
|
9
|
-
import starlette.requests
|
10
|
-
import starlette.status
|
11
|
-
from fastapi import Security, Depends
|
7
|
+
from fastapi import Security
|
12
8
|
from fastapi.security import APIKeyHeader
|
13
9
|
from pydantic import BaseModel, ConfigDict
|
14
10
|
|
15
11
|
from api.const import APIErrorCodes
|
16
12
|
from api.exception import APIException
|
17
|
-
from api.transmitted_api_data import TransmittedAPIData, get_transmitted_api_data
|
18
13
|
from arpakitlib.ar_func_util import is_async_callable, is_sync_function
|
19
14
|
from arpakitlib.ar_json_util import safely_transfer_obj_to_json_str_to_json_obj
|
20
15
|
from arpakitlib.ar_type_util import raise_for_type
|
16
|
+
from core.settings import get_cached_settings
|
21
17
|
|
22
18
|
|
23
19
|
class APIAuthData(BaseModel):
|
@@ -77,8 +73,7 @@ def api_auth(
|
|
77
73
|
api_key_string: str | None = Security(
|
78
74
|
APIKeyHeader(name="apikey", auto_error=False)
|
79
75
|
),
|
80
|
-
request:
|
81
|
-
transmitted_api_data: TransmittedAPIData = Depends(get_transmitted_api_data)
|
76
|
+
request: fastapi.requests.Request
|
82
77
|
) -> APIAuthData:
|
83
78
|
|
84
79
|
api_auth_data = APIAuthData(
|
@@ -139,7 +134,7 @@ def api_auth(
|
|
139
134
|
|
140
135
|
if require_api_key_string and not api_auth_data.api_key_string:
|
141
136
|
raise APIException(
|
142
|
-
status_code=
|
137
|
+
status_code=fastapi.status.HTTP_401_UNAUTHORIZED,
|
143
138
|
error_code=APIErrorCodes.cannot_authorize,
|
144
139
|
error_data=safely_transfer_obj_to_json_str_to_json_obj(api_auth_data.model_dump())
|
145
140
|
)
|
@@ -148,7 +143,7 @@ def api_auth(
|
|
148
143
|
|
149
144
|
if require_token_string and not api_auth_data.token_string:
|
150
145
|
raise APIException(
|
151
|
-
status_code=
|
146
|
+
status_code=fastapi.status.HTTP_401_UNAUTHORIZED,
|
152
147
|
error_code=APIErrorCodes.cannot_authorize,
|
153
148
|
error_data=safely_transfer_obj_to_json_str_to_json_obj(api_auth_data.model_dump())
|
154
149
|
)
|
@@ -159,7 +154,6 @@ def api_auth(
|
|
159
154
|
if is_async_callable(validate_api_key_func):
|
160
155
|
api_auth_data.is_api_key_correct = await validate_api_key_func(
|
161
156
|
api_auth_data=api_auth_data,
|
162
|
-
transmitted_api_data=transmitted_api_data,
|
163
157
|
request=request
|
164
158
|
)
|
165
159
|
elif is_sync_function(validate_api_key_func):
|
@@ -173,7 +167,6 @@ def api_auth(
|
|
173
167
|
if is_async_callable(validate_token_func):
|
174
168
|
api_auth_data.is_token_correct = await validate_token_func(
|
175
169
|
api_auth_data=api_auth_data,
|
176
|
-
transmitted_api_data=transmitted_api_data,
|
177
170
|
request=request
|
178
171
|
)
|
179
172
|
elif is_sync_function(validate_token_func):
|
@@ -186,7 +179,7 @@ def api_auth(
|
|
186
179
|
if require_correct_api_key:
|
187
180
|
if not api_auth_data.is_api_key_correct:
|
188
181
|
raise APIException(
|
189
|
-
status_code=
|
182
|
+
status_code=fastapi.status.HTTP_401_UNAUTHORIZED,
|
190
183
|
error_code=APIErrorCodes.cannot_authorize,
|
191
184
|
error_description="not api_auth_data.is_api_key_correct",
|
192
185
|
error_data=safely_transfer_obj_to_json_str_to_json_obj(api_auth_data.model_dump()),
|
@@ -197,7 +190,7 @@ def api_auth(
|
|
197
190
|
if require_correct_token:
|
198
191
|
if not api_auth_data.is_token_correct:
|
199
192
|
raise APIException(
|
200
|
-
status_code=
|
193
|
+
status_code=fastapi.status.HTTP_401_UNAUTHORIZED,
|
201
194
|
error_code=APIErrorCodes.cannot_authorize,
|
202
195
|
error_description="not api_auth_data.is_token_correct",
|
203
196
|
error_data=safely_transfer_obj_to_json_str_to_json_obj(api_auth_data.model_dump())
|
@@ -208,36 +201,34 @@ def api_auth(
|
|
208
201
|
return func
|
209
202
|
|
210
203
|
|
211
|
-
def
|
204
|
+
def correct_api_keys_from_settings__validate_api_key_func() -> Callable:
|
212
205
|
async def func(
|
213
206
|
*,
|
214
207
|
api_auth_data: APIAuthData,
|
215
|
-
|
216
|
-
request: starlette.requests.Request,
|
208
|
+
request: fastapi.requests.Request,
|
217
209
|
):
|
218
|
-
if
|
219
|
-
return
|
210
|
+
if get_cached_settings().api_correct_api_keys is None:
|
211
|
+
return False
|
220
212
|
if api_auth_data.api_key_string is None:
|
221
213
|
return False
|
222
|
-
if api_auth_data.api_key_string.strip() not in
|
214
|
+
if api_auth_data.api_key_string.strip() not in get_cached_settings().api_correct_api_keys:
|
223
215
|
return False
|
224
216
|
return True
|
225
217
|
|
226
218
|
return func
|
227
219
|
|
228
220
|
|
229
|
-
def
|
221
|
+
def correct_tokens_from_settings__validate_api_key_func() -> Callable:
|
230
222
|
async def func(
|
231
223
|
*,
|
232
224
|
api_auth_data: APIAuthData,
|
233
|
-
|
234
|
-
request: starlette.requests.Request,
|
225
|
+
request: fastapi.requests.Request,
|
235
226
|
):
|
236
|
-
if
|
237
|
-
return
|
227
|
+
if get_cached_settings().api_correct_tokens is None:
|
228
|
+
return False
|
238
229
|
if api_auth_data.token_string is None:
|
239
230
|
return False
|
240
|
-
if api_auth_data.token_string.strip() not in
|
231
|
+
if api_auth_data.token_string.strip() not in get_cached_settings().api_correct_tokens:
|
241
232
|
return False
|
242
233
|
return True
|
243
234
|
|
arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/api/create_api_app.py
RENAMED
@@ -2,30 +2,28 @@ import logging
|
|
2
2
|
import os
|
3
3
|
|
4
4
|
from fastapi import FastAPI
|
5
|
-
from
|
6
|
-
from
|
5
|
+
from fastapi.middleware.cors import CORSMiddleware
|
6
|
+
from fastapi.staticfiles import StaticFiles
|
7
7
|
|
8
8
|
from api.event import get_api_startup_events, get_api_shutdown_events
|
9
9
|
from api.exception_handler import add_exception_handler_to_app
|
10
10
|
from api.openapi_ui import add_local_openapi_ui_to_app
|
11
11
|
from api.router.main_router import main_api_router
|
12
|
-
from api.transmitted_api_data import get_cached_transmitted_api_data
|
13
12
|
from core.const import ProjectPaths
|
13
|
+
from core.settings import get_cached_settings
|
14
14
|
from core.util import setup_logging
|
15
15
|
|
16
16
|
_logger = logging.getLogger(__name__)
|
17
17
|
|
18
18
|
|
19
|
-
def create_api_app() -> FastAPI:
|
19
|
+
def create_api_app(*, prefix: str = "/api") -> FastAPI:
|
20
20
|
setup_logging()
|
21
21
|
|
22
22
|
_logger.info("start")
|
23
23
|
|
24
|
-
transmitted_api_data = get_cached_transmitted_api_data()
|
25
|
-
|
26
24
|
api_app = FastAPI(
|
27
|
-
title=
|
28
|
-
description=
|
25
|
+
title=get_cached_settings().project_name,
|
26
|
+
description=get_cached_settings().project_name,
|
29
27
|
docs_url=None,
|
30
28
|
redoc_url=None,
|
31
29
|
openapi_url="/openapi",
|
@@ -38,17 +36,6 @@ def create_api_app() -> FastAPI:
|
|
38
36
|
},
|
39
37
|
)
|
40
38
|
|
41
|
-
api_app.state.transmitted_api_data = transmitted_api_data
|
42
|
-
|
43
|
-
if transmitted_api_data.settings.media_dirpath is not None:
|
44
|
-
if not os.path.exists(transmitted_api_data.settings.media_dirpath):
|
45
|
-
os.makedirs(transmitted_api_data.settings.media_dirpath, exist_ok=True)
|
46
|
-
api_app.mount("/media", StaticFiles(directory=transmitted_api_data.settings.media_dirpath), name="media")
|
47
|
-
|
48
|
-
if not os.path.exists(ProjectPaths.static_dirpath):
|
49
|
-
os.makedirs(ProjectPaths.static_dirpath, exist_ok=True)
|
50
|
-
api_app.mount("/static", StaticFiles(directory=ProjectPaths.static_dirpath), name="static")
|
51
|
-
|
52
39
|
api_app.add_middleware(
|
53
40
|
CORSMiddleware,
|
54
41
|
allow_origins=["*"],
|
@@ -61,11 +48,23 @@ def create_api_app() -> FastAPI:
|
|
61
48
|
|
62
49
|
add_exception_handler_to_app(app=api_app)
|
63
50
|
|
64
|
-
api_app.include_router(
|
51
|
+
api_app.include_router(
|
52
|
+
prefix=prefix,
|
53
|
+
router=main_api_router
|
54
|
+
)
|
55
|
+
|
56
|
+
if get_cached_settings().media_dirpath is not None:
|
57
|
+
if not os.path.exists(get_cached_settings().media_dirpath):
|
58
|
+
os.makedirs(get_cached_settings().media_dirpath, exist_ok=True)
|
59
|
+
api_app.mount("/media", StaticFiles(directory=get_cached_settings().media_dirpath), name="media")
|
60
|
+
|
61
|
+
if not os.path.exists(ProjectPaths.static_dirpath):
|
62
|
+
os.makedirs(ProjectPaths.static_dirpath, exist_ok=True)
|
63
|
+
api_app.mount("/static", StaticFiles(directory=ProjectPaths.static_dirpath), name="static")
|
65
64
|
|
66
|
-
if
|
67
|
-
from
|
68
|
-
|
65
|
+
if get_cached_settings().api_enable_sqladmin:
|
66
|
+
from sqladmin_.add_admin_in_app import add_sqladmin_in_app
|
67
|
+
add_sqladmin_in_app(app=api_app)
|
69
68
|
|
70
69
|
_logger.info("finish")
|
71
70
|
|
@@ -1,10 +1,15 @@
|
|
1
1
|
import logging
|
2
2
|
from typing import Callable
|
3
3
|
|
4
|
-
from api.transmitted_api_data import get_cached_transmitted_api_data
|
5
4
|
from arpakitlib.ar_base_worker_util import safe_run_worker_in_background, SafeRunInBackgroundModes
|
5
|
+
from core.cache_file_storage_in_dir import get_cached_cache_file_storage_in_dir
|
6
|
+
from core.dump_file_storage_in_dir import get_cached_dump_file_storage_in_dir
|
7
|
+
from core.media_file_storage_in_dir import get_cached_media_file_storage_in_dir
|
8
|
+
from core.settings import get_cached_settings
|
9
|
+
from json_db.json_db import get_cached_json_db
|
6
10
|
from operation_execution.operation_executor_worker import create_operation_executor_worker
|
7
11
|
from operation_execution.scheduled_operation_creator_worker import create_scheduled_operation_creator_worker
|
12
|
+
from sqlalchemy_db.sqlalchemy_db import get_cached_sqlalchemy_db
|
8
13
|
|
9
14
|
_logger = logging.getLogger(__name__)
|
10
15
|
|
@@ -15,34 +20,34 @@ _logger = logging.getLogger(__name__)
|
|
15
20
|
async def async_api_startup_event():
|
16
21
|
_logger.info("start")
|
17
22
|
|
18
|
-
if
|
19
|
-
|
23
|
+
if get_cached_media_file_storage_in_dir() is not None:
|
24
|
+
get_cached_media_file_storage_in_dir().init()
|
20
25
|
|
21
|
-
if
|
22
|
-
|
26
|
+
if get_cached_cache_file_storage_in_dir() is not None:
|
27
|
+
get_cached_cache_file_storage_in_dir().init()
|
23
28
|
|
24
|
-
if
|
25
|
-
|
29
|
+
if get_cached_dump_file_storage_in_dir() is not None:
|
30
|
+
get_cached_dump_file_storage_in_dir().init()
|
26
31
|
|
27
32
|
if (
|
28
|
-
|
29
|
-
and
|
33
|
+
get_cached_sqlalchemy_db() is not None
|
34
|
+
and get_cached_settings().api_init_sqlalchemy_db
|
30
35
|
):
|
31
|
-
|
36
|
+
get_cached_sqlalchemy_db().init()
|
32
37
|
|
33
38
|
if (
|
34
|
-
|
35
|
-
and
|
39
|
+
get_cached_json_db() is not None
|
40
|
+
and get_cached_settings().api_init_json_db
|
36
41
|
):
|
37
|
-
|
42
|
+
get_cached_json_db().init()
|
38
43
|
|
39
|
-
if
|
44
|
+
if get_cached_settings().api_start_operation_executor_worker:
|
40
45
|
_ = safe_run_worker_in_background(
|
41
46
|
worker=create_operation_executor_worker(),
|
42
47
|
mode=SafeRunInBackgroundModes.thread
|
43
48
|
)
|
44
49
|
|
45
|
-
if
|
50
|
+
if get_cached_settings().api_start_scheduled_operation_creator_worker:
|
46
51
|
_ = safe_run_worker_in_background(
|
47
52
|
worker=create_scheduled_operation_creator_worker(),
|
48
53
|
mode=SafeRunInBackgroundModes.async_task
|
@@ -1,7 +1,6 @@
|
|
1
1
|
from typing import Any
|
2
2
|
|
3
3
|
import fastapi.security
|
4
|
-
import starlette.status
|
5
4
|
|
6
5
|
from api.const import APIErrorCodes
|
7
6
|
from api.schema.common.out import ErrorCommonSO
|
@@ -11,7 +10,7 @@ class APIException(fastapi.exceptions.HTTPException):
|
|
11
10
|
def __init__(
|
12
11
|
self,
|
13
12
|
*,
|
14
|
-
status_code: int =
|
13
|
+
status_code: int = fastapi.status.HTTP_400_BAD_REQUEST,
|
15
14
|
error_code: str | None = APIErrorCodes.unknown_error,
|
16
15
|
error_specification_code: str | None = None,
|
17
16
|
error_description: str | None = None,
|
arpakitlib/{_arpakit_project_template_v1 → _arpakit_project_template_v_1}/api/exception_handler.py
RENAMED
@@ -4,15 +4,8 @@ import logging
|
|
4
4
|
from contextlib import suppress
|
5
5
|
from typing import Any, Callable
|
6
6
|
|
7
|
-
import fastapi
|
8
|
-
import fastapi.exceptions
|
9
|
-
import fastapi.responses
|
10
|
-
import fastapi.security
|
7
|
+
import fastapi
|
11
8
|
import starlette.exceptions
|
12
|
-
import starlette.exceptions
|
13
|
-
import starlette.requests
|
14
|
-
import starlette.status
|
15
|
-
from fastapi import FastAPI
|
16
9
|
|
17
10
|
from api.const import APIErrorCodes
|
18
11
|
from api.exception import APIException
|
@@ -45,10 +38,10 @@ def create_exception_handler(
|
|
45
38
|
async_funcs_after = [v for v in async_funcs_after if v is not None]
|
46
39
|
|
47
40
|
async def func(
|
48
|
-
request:
|
41
|
+
request: fastapi.requests.Request,
|
49
42
|
exception: Exception
|
50
43
|
) -> APIJSONResponse:
|
51
|
-
status_code =
|
44
|
+
status_code = fastapi.status.HTTP_500_INTERNAL_SERVER_ERROR
|
52
45
|
|
53
46
|
error_common_so = ErrorCommonSO(
|
54
47
|
has_error=True,
|
@@ -66,25 +59,28 @@ def create_exception_handler(
|
|
66
59
|
error_common_so = exception.error_common_so
|
67
60
|
error_common_so.error_data = combine_dicts(old_error_data, error_common_so.error_data)
|
68
61
|
|
69
|
-
elif
|
62
|
+
elif (
|
63
|
+
isinstance(exception, fastapi.exceptions.HTTPException)
|
64
|
+
or isinstance(exception, starlette.exceptions.HTTPException)
|
65
|
+
):
|
70
66
|
status_code = exception.status_code
|
71
|
-
if status_code in (
|
67
|
+
if status_code in (fastapi.status.HTTP_403_FORBIDDEN, fastapi.status.HTTP_401_UNAUTHORIZED):
|
72
68
|
error_common_so.error_code = APIErrorCodes.cannot_authorize
|
73
|
-
elif status_code ==
|
69
|
+
elif status_code == fastapi.status.HTTP_404_NOT_FOUND:
|
74
70
|
error_common_so.error_code = APIErrorCodes.not_found
|
75
71
|
else:
|
76
|
-
status_code =
|
72
|
+
status_code = fastapi.status.HTTP_500_INTERNAL_SERVER_ERROR
|
77
73
|
with suppress(Exception):
|
78
74
|
error_common_so.error_data["exception.detail"] = exception.detail
|
79
75
|
|
80
76
|
elif isinstance(exception, fastapi.exceptions.RequestValidationError):
|
81
|
-
status_code =
|
77
|
+
status_code = fastapi.status.HTTP_422_UNPROCESSABLE_ENTITY
|
82
78
|
error_common_so.error_code = APIErrorCodes.error_in_request
|
83
79
|
with suppress(Exception):
|
84
80
|
error_common_so.error_data["exception.errors"] = str(exception.errors()) if exception.errors() else {}
|
85
81
|
|
86
82
|
else:
|
87
|
-
status_code =
|
83
|
+
status_code = fastapi.status.HTTP_500_INTERNAL_SERVER_ERROR
|
88
84
|
error_common_so.error_code = APIErrorCodes.unknown_error
|
89
85
|
|
90
86
|
if error_common_so.error_code is not None:
|
@@ -96,10 +92,10 @@ def create_exception_handler(
|
|
96
92
|
)
|
97
93
|
|
98
94
|
if error_common_so.error_code == APIErrorCodes.not_found:
|
99
|
-
status_code =
|
95
|
+
status_code = fastapi.status.HTTP_404_NOT_FOUND
|
100
96
|
|
101
97
|
if error_common_so.error_code == APIErrorCodes.cannot_authorize:
|
102
|
-
status_code =
|
98
|
+
status_code = fastapi.status.HTTP_401_UNAUTHORIZED
|
103
99
|
|
104
100
|
error_common_so.error_data["status_code"] = status_code
|
105
101
|
|
@@ -108,15 +104,23 @@ def create_exception_handler(
|
|
108
104
|
_transmitted_kwargs = {}
|
109
105
|
for func_before in funcs_before:
|
110
106
|
if is_async_callable(func_before):
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
107
|
+
try:
|
108
|
+
_func_before_res = await func_before(
|
109
|
+
request=request, status_code=status_code, error_common_so=error_common_so, exception=exception,
|
110
|
+
transmitted_kwargs=_transmitted_kwargs
|
111
|
+
)
|
112
|
+
except Exception as exception_:
|
113
|
+
_logger.exception(exception_)
|
114
|
+
raise exception_
|
115
115
|
elif is_sync_function(func_before):
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
116
|
+
try:
|
117
|
+
_func_before_res = func_before(
|
118
|
+
request=request, status_code=status_code, error_common_so=error_common_so, exception=exception,
|
119
|
+
transmitted_kwargs=_transmitted_kwargs
|
120
|
+
)
|
121
|
+
except Exception as exception_:
|
122
|
+
_logger.exception(exception_)
|
123
|
+
raise exception_
|
120
124
|
else:
|
121
125
|
raise TypeError("unknown func_before type")
|
122
126
|
if _func_before_res is not None:
|
@@ -150,7 +154,7 @@ def logging__api_func_before_in_handle_exception(
|
|
150
154
|
|
151
155
|
def func(
|
152
156
|
*,
|
153
|
-
request:
|
157
|
+
request: fastapi.requests.Request,
|
154
158
|
status_code: int,
|
155
159
|
error_common_so: ErrorCommonSO,
|
156
160
|
exception: Exception,
|
@@ -185,7 +189,7 @@ def story_log__api_func_before_in_handle_exception(
|
|
185
189
|
|
186
190
|
async def async_func(
|
187
191
|
*,
|
188
|
-
request:
|
192
|
+
request: fastapi.requests.Request,
|
189
193
|
status_code: int,
|
190
194
|
error_common_so: ErrorCommonSO,
|
191
195
|
exception: Exception,
|
@@ -231,7 +235,10 @@ def get_exception_handler() -> Callable:
|
|
231
235
|
funcs_before = []
|
232
236
|
async_funcs_after = []
|
233
237
|
|
234
|
-
if
|
238
|
+
if (
|
239
|
+
get_cached_settings().api_story_log__api_func_before_in_exception_handler
|
240
|
+
and get_cached_sqlalchemy_db() is not None
|
241
|
+
):
|
235
242
|
funcs_before.append(
|
236
243
|
story_log__api_func_before_in_handle_exception(
|
237
244
|
ignore_api_error_codes=[
|
@@ -240,9 +247,9 @@ def get_exception_handler() -> Callable:
|
|
240
247
|
APIErrorCodes.not_found
|
241
248
|
],
|
242
249
|
ignore_status_codes=[
|
243
|
-
|
244
|
-
|
245
|
-
|
250
|
+
fastapi.status.HTTP_401_UNAUTHORIZED,
|
251
|
+
fastapi.status.HTTP_422_UNPROCESSABLE_ENTITY,
|
252
|
+
fastapi.status.HTTP_404_NOT_FOUND
|
246
253
|
],
|
247
254
|
ignore_exception_types=[
|
248
255
|
fastapi.exceptions.RequestValidationError
|
@@ -258,9 +265,9 @@ def get_exception_handler() -> Callable:
|
|
258
265
|
APIErrorCodes.not_found
|
259
266
|
],
|
260
267
|
ignore_status_codes=[
|
261
|
-
|
262
|
-
|
263
|
-
|
268
|
+
fastapi.status.HTTP_401_UNAUTHORIZED,
|
269
|
+
fastapi.status.HTTP_422_UNPROCESSABLE_ENTITY,
|
270
|
+
fastapi.status.HTTP_404_NOT_FOUND
|
264
271
|
],
|
265
272
|
ignore_exception_types=[
|
266
273
|
fastapi.exceptions.RequestValidationError
|
@@ -274,7 +281,7 @@ def get_exception_handler() -> Callable:
|
|
274
281
|
)
|
275
282
|
|
276
283
|
|
277
|
-
def add_exception_handler_to_app(*, app: FastAPI) -> FastAPI:
|
284
|
+
def add_exception_handler_to_app(*, app: fastapi.FastAPI) -> fastapi.FastAPI:
|
278
285
|
exception_handler = get_exception_handler()
|
279
286
|
|
280
287
|
app.add_exception_handler(
|
@@ -289,6 +296,10 @@ def add_exception_handler_to_app(*, app: FastAPI) -> FastAPI:
|
|
289
296
|
exc_class_or_status_code=fastapi.exceptions.RequestValidationError,
|
290
297
|
handler=exception_handler
|
291
298
|
)
|
299
|
+
app.add_exception_handler(
|
300
|
+
exc_class_or_status_code=fastapi.exceptions.HTTPException,
|
301
|
+
handler=exception_handler
|
302
|
+
)
|
292
303
|
app.add_exception_handler(
|
293
304
|
exc_class_or_status_code=starlette.exceptions.HTTPException,
|
294
305
|
handler=exception_handler
|
@@ -1,12 +1,16 @@
|
|
1
|
-
import
|
2
|
-
|
1
|
+
from typing import Any
|
2
|
+
|
3
|
+
import fastapi
|
3
4
|
|
4
5
|
from api.schema.v1.out import BaseSO
|
5
6
|
from arpakitlib.ar_json_util import safely_transfer_obj_to_json_str_to_json_obj
|
6
7
|
|
7
8
|
|
8
9
|
class APIJSONResponse(fastapi.responses.JSONResponse):
|
9
|
-
def __init__(
|
10
|
+
def __init__(
|
11
|
+
self, *,
|
12
|
+
content: dict[str, Any] | list[Any] | BaseSO | None, status_code: int = fastapi.status.HTTP_200_OK
|
13
|
+
):
|
10
14
|
if isinstance(content, dict):
|
11
15
|
content = safely_transfer_obj_to_json_str_to_json_obj(content)
|
12
16
|
elif isinstance(content, list):
|
@@ -0,0 +1,22 @@
|
|
1
|
+
import fastapi
|
2
|
+
from fastapi import APIRouter
|
3
|
+
|
4
|
+
from api.schema.common.out import ErrorCommonSO, RawDataCommonSO
|
5
|
+
from util.read_arpakitlib_project_template_file import read_arpakitlib_project_template_file
|
6
|
+
|
7
|
+
api_router = APIRouter()
|
8
|
+
|
9
|
+
|
10
|
+
@api_router.get(
|
11
|
+
"",
|
12
|
+
name="Get arpakitlib info",
|
13
|
+
status_code=fastapi.status.HTTP_200_OK,
|
14
|
+
response_model=RawDataCommonSO | ErrorCommonSO
|
15
|
+
)
|
16
|
+
async def _(
|
17
|
+
*,
|
18
|
+
request: fastapi.requests.Request,
|
19
|
+
response: fastapi.responses.Response,
|
20
|
+
):
|
21
|
+
arpakitlib_project_template_data = read_arpakitlib_project_template_file()
|
22
|
+
return RawDataCommonSO(data=arpakitlib_project_template_data)
|
@@ -1,18 +1,18 @@
|
|
1
1
|
import fastapi.requests
|
2
2
|
from fastapi import APIRouter, Depends
|
3
|
-
from starlette import status
|
4
3
|
|
5
|
-
from api.auth import APIAuthData, api_auth,
|
6
|
-
|
4
|
+
from api.auth import APIAuthData, api_auth, correct_api_keys_from_settings__validate_api_key_func, \
|
5
|
+
correct_tokens_from_settings__validate_api_key_func
|
7
6
|
from api.schema.common.out import ErrorCommonSO, RawDataCommonSO
|
8
7
|
|
9
8
|
api_router = APIRouter()
|
10
9
|
|
11
10
|
|
12
11
|
@api_router.get(
|
13
|
-
"",
|
12
|
+
path="",
|
13
|
+
name="Check auth",
|
14
|
+
status_code=fastapi.status.HTTP_200_OK,
|
14
15
|
response_model=RawDataCommonSO | ErrorCommonSO,
|
15
|
-
status_code=status.HTTP_200_OK
|
16
16
|
)
|
17
17
|
async def _(
|
18
18
|
*,
|
@@ -21,8 +21,8 @@ async def _(
|
|
21
21
|
api_auth_data: APIAuthData = Depends(api_auth(
|
22
22
|
require_api_key_string=False,
|
23
23
|
require_token_string=False,
|
24
|
-
validate_api_key_func=
|
25
|
-
validate_token_func=
|
24
|
+
validate_api_key_func=correct_api_keys_from_settings__validate_api_key_func(),
|
25
|
+
validate_token_func=correct_tokens_from_settings__validate_api_key_func(),
|
26
26
|
require_correct_api_key=False,
|
27
27
|
require_correct_token=False,
|
28
28
|
))
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import fastapi
|
2
|
+
from fastapi import APIRouter
|
3
|
+
|
4
|
+
from api.schema.common.out import RawDataCommonSO, ErrorCommonSO
|
5
|
+
from arpakitlib.ar_logging_util import init_log_file
|
6
|
+
from core.settings import get_cached_settings
|
7
|
+
|
8
|
+
api_router = APIRouter()
|
9
|
+
|
10
|
+
|
11
|
+
@api_router.get(
|
12
|
+
path="",
|
13
|
+
name="Clear log file",
|
14
|
+
status_code=fastapi.status.HTTP_200_OK,
|
15
|
+
response_model=RawDataCommonSO | ErrorCommonSO,
|
16
|
+
)
|
17
|
+
async def _(
|
18
|
+
*,
|
19
|
+
request: fastapi.requests.Request,
|
20
|
+
response: fastapi.responses.Response,
|
21
|
+
):
|
22
|
+
init_log_file(log_filepath=get_cached_settings().log_filepath)
|
23
|
+
with open(file=get_cached_settings().log_filepath, mode="w") as f:
|
24
|
+
f.write("")
|
25
|
+
return RawDataCommonSO(data={"log_file_was_cleared": True})
|
@@ -1,6 +1,5 @@
|
|
1
1
|
import fastapi.requests
|
2
2
|
from fastapi import APIRouter
|
3
|
-
from starlette import status
|
4
3
|
|
5
4
|
from api.const import APIErrorCodes, APIErrorSpecificationCodes
|
6
5
|
from api.schema.common.out import ErrorCommonSO, ErrorsInfoCommonSO
|
@@ -10,8 +9,9 @@ api_router = APIRouter()
|
|
10
9
|
|
11
10
|
@api_router.get(
|
12
11
|
"",
|
12
|
+
name="Get errors info",
|
13
|
+
status_code=fastapi.status.HTTP_200_OK,
|
13
14
|
response_model=ErrorsInfoCommonSO | ErrorCommonSO,
|
14
|
-
status_code=status.HTTP_200_OK
|
15
15
|
)
|
16
16
|
async def _(
|
17
17
|
*,
|
@@ -0,0 +1,23 @@
|
|
1
|
+
import fastapi
|
2
|
+
from fastapi import APIRouter
|
3
|
+
from fastapi.responses import FileResponse
|
4
|
+
|
5
|
+
from arpakitlib.ar_logging_util import init_log_file
|
6
|
+
from core.settings import get_cached_settings
|
7
|
+
|
8
|
+
api_router = APIRouter()
|
9
|
+
|
10
|
+
|
11
|
+
@api_router.get(
|
12
|
+
path="",
|
13
|
+
name="Get log file",
|
14
|
+
status_code=fastapi.status.HTTP_200_OK,
|
15
|
+
response_class=FileResponse
|
16
|
+
)
|
17
|
+
async def _(
|
18
|
+
*,
|
19
|
+
request: fastapi.requests.Request,
|
20
|
+
response: fastapi.responses.Response,
|
21
|
+
):
|
22
|
+
init_log_file(log_filepath=get_cached_settings().log_filepath)
|
23
|
+
return FileResponse(path=get_cached_settings().log_filepath)
|
@@ -1,5 +1,4 @@
|
|
1
1
|
import fastapi
|
2
|
-
import starlette.status
|
3
2
|
from fastapi import APIRouter
|
4
3
|
|
5
4
|
from api.schema.common.out import ErrorCommonSO
|
@@ -10,8 +9,9 @@ api_router = APIRouter()
|
|
10
9
|
|
11
10
|
@api_router.get(
|
12
11
|
"",
|
12
|
+
name="Healthcheck",
|
13
|
+
status_code=fastapi.status.HTTP_200_OK,
|
13
14
|
response_model=HealthcheckV1SO | ErrorCommonSO,
|
14
|
-
status_code=starlette.status.HTTP_200_OK
|
15
15
|
)
|
16
16
|
async def _(
|
17
17
|
*,
|