arpakitlib 1.7.24__py3-none-any.whl → 1.7.26__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/ar_fastapi_util.py +16 -9
- {arpakitlib-1.7.24.dist-info → arpakitlib-1.7.26.dist-info}/METADATA +1 -1
- {arpakitlib-1.7.24.dist-info → arpakitlib-1.7.26.dist-info}/RECORD +7 -7
- {arpakitlib-1.7.24.dist-info → arpakitlib-1.7.26.dist-info}/LICENSE +0 -0
- {arpakitlib-1.7.24.dist-info → arpakitlib-1.7.26.dist-info}/NOTICE +0 -0
- {arpakitlib-1.7.24.dist-info → arpakitlib-1.7.26.dist-info}/WHEEL +0 -0
- {arpakitlib-1.7.24.dist-info → arpakitlib-1.7.26.dist-info}/entry_points.txt +0 -0
arpakitlib/ar_fastapi_util.py
CHANGED
@@ -259,8 +259,6 @@ def create_handle_exception_creating_story_log(
|
|
259
259
|
exception: Exception,
|
260
260
|
**kwargs
|
261
261
|
) -> (int, ErrorSO, dict[str, Any]):
|
262
|
-
print(222, type(request))
|
263
|
-
|
264
262
|
sqlalchemy_db.init()
|
265
263
|
traceback_str = "".join(traceback.format_exception(type(exception), exception, exception.__traceback__))
|
266
264
|
with sqlalchemy_db.new_session() as session:
|
@@ -456,7 +454,7 @@ def base_api_auth(
|
|
456
454
|
fastapi.security.HTTPBearer(auto_error=False)
|
457
455
|
),
|
458
456
|
api_key_string: str | None = Security(APIKeyHeader(name="apikey", auto_error=False)),
|
459
|
-
request:
|
457
|
+
request: starlette.requests.Request
|
460
458
|
) -> BaseAPIAuthData:
|
461
459
|
|
462
460
|
api_auth_data = BaseAPIAuthData(
|
@@ -530,14 +528,21 @@ def base_api_auth(
|
|
530
528
|
return func
|
531
529
|
|
532
530
|
|
531
|
+
class CheckAPIKeyAPIAuthData(BaseAPIAuthData):
|
532
|
+
require_check_api_key: bool = False
|
533
|
+
is_api_key_correct: bool | None = None
|
534
|
+
|
535
|
+
|
533
536
|
def api_auth_check_api_key(
|
534
537
|
*,
|
535
|
-
|
538
|
+
require_check_api_key: bool = True,
|
536
539
|
check_api_key_func: Callable | None = None,
|
537
540
|
correct_api_key: str | None = None
|
538
541
|
):
|
539
|
-
if
|
542
|
+
if require_check_api_key:
|
540
543
|
require_api_key_string = True
|
544
|
+
else:
|
545
|
+
require_api_key_string = False
|
541
546
|
|
542
547
|
if correct_api_key is not None:
|
543
548
|
check_api_key_func = lambda v: v == correct_api_key
|
@@ -545,16 +550,18 @@ def api_auth_check_api_key(
|
|
545
550
|
async def func(
|
546
551
|
*,
|
547
552
|
base_need_api_auth_data: BaseAPIAuthData = Depends(base_api_auth(
|
548
|
-
require_api_key_string=
|
553
|
+
require_api_key_string=require_api_key_string,
|
549
554
|
require_token_string=False
|
550
555
|
)),
|
551
556
|
transmitted_api_data: BaseTransmittedAPIData = Depends(get_transmitted_api_data),
|
552
|
-
request:
|
557
|
+
request: starlette.requests.Request
|
553
558
|
):
|
554
|
-
|
555
|
-
|
559
|
+
if not require_check_api_key:
|
560
|
+
return # TODO
|
556
561
|
# TODO
|
557
562
|
|
563
|
+
return func
|
564
|
+
|
558
565
|
|
559
566
|
def simple_api_router_for_testing():
|
560
567
|
router = APIRouter(tags=["Testing"])
|
@@ -133,7 +133,7 @@ arpakitlib/ar_fastapi_static/swagger-ui/swagger-ui.css,sha256=jzPZlgJTFwSdSphk9C
|
|
133
133
|
arpakitlib/ar_fastapi_static/swagger-ui/swagger-ui.css.map,sha256=5wq8eXMLU6Zxb45orZPL1zAsBFJReFw6GjYqGpUX3hg,262650
|
134
134
|
arpakitlib/ar_fastapi_static/swagger-ui/swagger-ui.js,sha256=ffrLZHHEQ_g84A-ul3yWa10Kk09waOAxHcQXPuZuavg,339292
|
135
135
|
arpakitlib/ar_fastapi_static/swagger-ui/swagger-ui.js.map,sha256=9UhIW7MqCOZPAz1Sl1IKfZUuhWU0p-LJqrnjjJD9Xhc,1159454
|
136
|
-
arpakitlib/ar_fastapi_util.py,sha256=
|
136
|
+
arpakitlib/ar_fastapi_util.py,sha256=PrGTPwC9OzFbDOEWs7_X9ZsQ_legE3tZ9IlhPsOYELc,23321
|
137
137
|
arpakitlib/ar_file_storage_in_dir_util.py,sha256=D3e3rGuHoI6xqAA5mVvEpVVpOWY1jyjNsjj2UhyHRbE,3674
|
138
138
|
arpakitlib/ar_file_util.py,sha256=XiwmeycxoLqtYnGOu5q6IEaJJXilZvtLvsKDKtwqSLY,137
|
139
139
|
arpakitlib/ar_hash_util.py,sha256=Iqy6KBAOLBQMFLWv676boI5sV7atT2B-fb7aCdHOmIQ,340
|
@@ -162,9 +162,9 @@ arpakitlib/ar_str_util.py,sha256=oCEtQ_TTn35OEz9jCNLjbhopq76JmaifD_iYR-nEJJ4,214
|
|
162
162
|
arpakitlib/ar_type_util.py,sha256=GNc9PgFKonj5lRlAHSnVPBN5nLIslrG8GTiZHjkf05w,2138
|
163
163
|
arpakitlib/ar_yookassa_api_client_util.py,sha256=sh4fcUkAkdOetFn9JYoTvjcSXP-M1wU04KEY-ECLfLg,5137
|
164
164
|
arpakitlib/ar_zabbix_api_client_util.py,sha256=Q-VR4MvoZ9aHwZeYZr9G3LwN-ANx1T5KFmF6pvPM-9M,6402
|
165
|
-
arpakitlib-1.7.
|
166
|
-
arpakitlib-1.7.
|
167
|
-
arpakitlib-1.7.
|
168
|
-
arpakitlib-1.7.
|
169
|
-
arpakitlib-1.7.
|
170
|
-
arpakitlib-1.7.
|
165
|
+
arpakitlib-1.7.26.dist-info/LICENSE,sha256=GPEDQMam2r7FSTYqM1mm7aKnxLaWcBotH7UvQtea-ec,11355
|
166
|
+
arpakitlib-1.7.26.dist-info/METADATA,sha256=1yIKkmYFSiBBRQlC4OBymOt9r000Onr59QUMHQrnZNs,2824
|
167
|
+
arpakitlib-1.7.26.dist-info/NOTICE,sha256=95aUzaPJjVpDsGAsNzVnq7tHTxAl0s5UFznCTkVCau4,763
|
168
|
+
arpakitlib-1.7.26.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
169
|
+
arpakitlib-1.7.26.dist-info/entry_points.txt,sha256=36xqR3PJFT2kuwjkM_EqoIy0qFUDPKSm_mJaI7emewE,87
|
170
|
+
arpakitlib-1.7.26.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|