arpakitlib 1.7.39__py3-none-any.whl → 1.7.41__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.
@@ -10,6 +10,7 @@ from arpakitlib.ar_type_util import raise_for_type
10
10
  from src.api.event import StartupAPIEvent, ShutdownAPIEvent
11
11
  from src.api.router.v1.main_router import api_v1_main_router
12
12
  from src.api.transmitted_api_data import TransmittedAPIData
13
+ from src.core.const import STATIC_DIRPATH
13
14
  from src.core.settings import get_cached_settings
14
15
  from src.core.util import get_cached_sqlalchemy_db, get_cached_media_file_storage_in_dir, \
15
16
  get_cached_cache_file_storage_in_dir, get_cached_dump_file_storage_in_dir, setup_logging
@@ -97,7 +98,8 @@ def create_api_app() -> FastAPI:
97
98
  transmitted_api_data=transmitted_api_data,
98
99
  main_api_router=api_v1_main_router,
99
100
  contact=_DEFAULT_CONTACT,
100
- media_dirpath=settings.media_dirpath
101
+ media_dirpath=settings.media_dirpath,
102
+ static_dirpath=STATIC_DIRPATH
101
103
  )
102
104
 
103
105
  return api_app
@@ -0,0 +1 @@
1
+ Healthcheck
@@ -638,7 +638,8 @@ def create_fastapi_app(
638
638
  transmitted_api_data: BaseTransmittedAPIData = BaseTransmittedAPIData(),
639
639
  main_api_router: APIRouter = simple_api_router_for_testing(),
640
640
  contact: dict[str, Any] | None = None,
641
- media_dirpath: str | None = None
641
+ media_dirpath: str | None = None,
642
+ static_dirpath: str | None = None
642
643
  ):
643
644
  setup_normal_logging(log_filepath=log_filepath)
644
645
 
@@ -669,6 +670,11 @@ def create_fastapi_app(
669
670
  os.makedirs(media_dirpath, exist_ok=True)
670
671
  app.mount("/media", StaticFiles(directory=media_dirpath), name="media")
671
672
 
673
+ if static_dirpath is not None:
674
+ if not os.path.exists(static_dirpath):
675
+ os.makedirs(static_dirpath, exist_ok=True)
676
+ app.mount("/static", StaticFiles(directory=static_dirpath), name="static")
677
+
672
678
  app.state.transmitted_api_data = transmitted_api_data
673
679
 
674
680
  add_cors_to_app(app=app)
@@ -4,3 +4,17 @@ import os
4
4
  def raise_if_path_not_exists(path: str):
5
5
  if not os.path.exists(path):
6
6
  raise Exception(f"path {path} not exists")
7
+
8
+
9
+ def clear_text_file(filepath: str):
10
+ if not os.path.exists(filepath):
11
+ return
12
+ with open(filepath, mode="w") as f:
13
+ f.write("")
14
+
15
+
16
+ def create_text_file(filepath: str, text: str = ""):
17
+ if os.path.exists(filepath):
18
+ return
19
+ with open(filepath, mode="w") as f:
20
+ f.write(text)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: arpakitlib
3
- Version: 1.7.39
3
+ Version: 1.7.41
4
4
  Summary: arpakitlib
5
5
  Home-page: https://github.com/ARPAKIT-Company/arpakitlib
6
6
  License: Apache-2.0
@@ -71,7 +71,7 @@ arpakitlib/_arpakit_project_template/src/additional_model/__init__.py,sha256=47D
71
71
  arpakitlib/_arpakit_project_template/src/additional_model/additional_model.py,sha256=4KCOvto9Hj5eMYpvfaJChghhR9bkCvKluGGPWrTezoY,134
72
72
  arpakitlib/_arpakit_project_template/src/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
73
73
  arpakitlib/_arpakit_project_template/src/api/asgi.py,sha256=a5UBxOyNC8NG3E0ayhiDo3t5tPoB3WtOf2gbZJFWBAA,74
74
- arpakitlib/_arpakit_project_template/src/api/create_api_app.py,sha256=eUky7ReRLg6LtiuZHBQvDUmOhhlfDLr9eVaB_h-VjFU,4415
74
+ arpakitlib/_arpakit_project_template/src/api/create_api_app.py,sha256=uDEnLAPugb3rXuuJDMkfs8i6aIGYo0-_JP-PG6Spdr4,4496
75
75
  arpakitlib/_arpakit_project_template/src/api/event.py,sha256=58wCVyVSIe_kydWi44M0Wvp7bTnV8xvO30gMXzjbFYc,750
76
76
  arpakitlib/_arpakit_project_template/src/api/router/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
77
77
  arpakitlib/_arpakit_project_template/src/api/router/v1/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -117,6 +117,7 @@ arpakitlib/ar_dict_util.py,sha256=cF5LQJ6tLqyGoEXfDljMDZrikeZoWPw7CgINHIFGvXM,41
117
117
  arpakitlib/ar_dream_ai_api_client_util.py,sha256=QF9XK7xK5ny1fvkcG4e0pfCySNNFRNPy0x0cmxfsAak,2818
118
118
  arpakitlib/ar_encrypt_decrypt_util.py,sha256=GhWnp7HHkbhwFVVCzO1H07m-5gryr4yjWsXjOaNQm1Y,520
119
119
  arpakitlib/ar_enumeration_util.py,sha256=0DN46uyI0Gu9JPDgso3XPbnre7hZZefYTZwmmE1iYH4,2250
120
+ arpakitlib/ar_fastapi_static/healthcheck,sha256=IIO7Wvjwlr2-LPSQ7Y8O35hcI6t0_s8zqITDxkYCO8I,11
120
121
  arpakitlib/ar_fastapi_static/redoc/redoc.standalone.js,sha256=WCuodUNv1qVh0oW5fjnJDwb5AwOue73jKHdI9z8iGKU,909365
121
122
  arpakitlib/ar_fastapi_static/swagger-ui/favicon-16x16.png,sha256=ryStYE3Xs7zaj5dauXMHX0ovcKQIeUShL474tjo-B8I,665
122
123
  arpakitlib/ar_fastapi_static/swagger-ui/favicon-32x32.png,sha256=PtYS9B4FDKXnAAytbxy-fn2jn2X8qZwC6Z5lkQVuWDc,628
@@ -136,9 +137,9 @@ arpakitlib/ar_fastapi_static/swagger-ui/swagger-ui.css,sha256=jzPZlgJTFwSdSphk9C
136
137
  arpakitlib/ar_fastapi_static/swagger-ui/swagger-ui.css.map,sha256=5wq8eXMLU6Zxb45orZPL1zAsBFJReFw6GjYqGpUX3hg,262650
137
138
  arpakitlib/ar_fastapi_static/swagger-ui/swagger-ui.js,sha256=ffrLZHHEQ_g84A-ul3yWa10Kk09waOAxHcQXPuZuavg,339292
138
139
  arpakitlib/ar_fastapi_static/swagger-ui/swagger-ui.js.map,sha256=9UhIW7MqCOZPAz1Sl1IKfZUuhWU0p-LJqrnjjJD9Xhc,1159454
139
- arpakitlib/ar_fastapi_util.py,sha256=xZyQ2AmGmmf4lGiK4ykJxTSFZKzX-MJ9LJ92BOCARgY,24428
140
+ arpakitlib/ar_fastapi_util.py,sha256=7-gPezpK4_R8jey78FvNiaUS-sfRTlzIIfRQqEoPMSk,24692
140
141
  arpakitlib/ar_file_storage_in_dir_util.py,sha256=D3e3rGuHoI6xqAA5mVvEpVVpOWY1jyjNsjj2UhyHRbE,3674
141
- arpakitlib/ar_file_util.py,sha256=XiwmeycxoLqtYnGOu5q6IEaJJXilZvtLvsKDKtwqSLY,137
142
+ arpakitlib/ar_file_util.py,sha256=07xCF7paAUP2JUyfpeX0l3N1oCSma7qAcBmrCIZVi3g,452
142
143
  arpakitlib/ar_hash_util.py,sha256=Iqy6KBAOLBQMFLWv676boI5sV7atT2B-fb7aCdHOmIQ,340
143
144
  arpakitlib/ar_http_request_util.py,sha256=DfzITtgbWJLkyaAIa0cBZZZqLE0EXx-TsHZkiaRy3Tg,3649
144
145
  arpakitlib/ar_ip_util.py,sha256=aEAa1Hvobh9DWX7cmBAPLqnXSTiKe2hRk-WJaiKMaI8,1009
@@ -165,9 +166,9 @@ arpakitlib/ar_str_util.py,sha256=oCEtQ_TTn35OEz9jCNLjbhopq76JmaifD_iYR-nEJJ4,214
165
166
  arpakitlib/ar_type_util.py,sha256=GNc9PgFKonj5lRlAHSnVPBN5nLIslrG8GTiZHjkf05w,2138
166
167
  arpakitlib/ar_yookassa_api_client_util.py,sha256=sh4fcUkAkdOetFn9JYoTvjcSXP-M1wU04KEY-ECLfLg,5137
167
168
  arpakitlib/ar_zabbix_api_client_util.py,sha256=Q-VR4MvoZ9aHwZeYZr9G3LwN-ANx1T5KFmF6pvPM-9M,6402
168
- arpakitlib-1.7.39.dist-info/LICENSE,sha256=GPEDQMam2r7FSTYqM1mm7aKnxLaWcBotH7UvQtea-ec,11355
169
- arpakitlib-1.7.39.dist-info/METADATA,sha256=KMqDClqko82D4vC3fKjUxkr8g8JEyynsflDfQET87fI,2824
170
- arpakitlib-1.7.39.dist-info/NOTICE,sha256=95aUzaPJjVpDsGAsNzVnq7tHTxAl0s5UFznCTkVCau4,763
171
- arpakitlib-1.7.39.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
172
- arpakitlib-1.7.39.dist-info/entry_points.txt,sha256=36xqR3PJFT2kuwjkM_EqoIy0qFUDPKSm_mJaI7emewE,87
173
- arpakitlib-1.7.39.dist-info/RECORD,,
169
+ arpakitlib-1.7.41.dist-info/LICENSE,sha256=GPEDQMam2r7FSTYqM1mm7aKnxLaWcBotH7UvQtea-ec,11355
170
+ arpakitlib-1.7.41.dist-info/METADATA,sha256=e1hkLoyTSNCk7_bjiX-jQ6DGV7_N_4ezH_795-nio6M,2824
171
+ arpakitlib-1.7.41.dist-info/NOTICE,sha256=95aUzaPJjVpDsGAsNzVnq7tHTxAl0s5UFznCTkVCau4,763
172
+ arpakitlib-1.7.41.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
173
+ arpakitlib-1.7.41.dist-info/entry_points.txt,sha256=36xqR3PJFT2kuwjkM_EqoIy0qFUDPKSm_mJaI7emewE,87
174
+ arpakitlib-1.7.41.dist-info/RECORD,,