Initial commit

This commit is contained in:
Mustafa KURU
2026-05-03 23:47:54 +03:00
commit 1dac1749bf
74 changed files with 6697 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
import os
from functools import wraps
from flask import Response, request
ML_API_TOKEN = os.environ.get("ML_API_TOKEN")
def token_required(f):
@wraps(f)
def check_authorization(*args, **kwargs):
if (
request.headers.get("Authorization") == f"Bearer {ML_API_TOKEN}"
or request.args.get("token") == ML_API_TOKEN
):
return f(*args, **kwargs)
return Response(status=401)
@wraps(f)
def passthru(*args, **kwargs):
return f(*args, **kwargs)
if ML_API_TOKEN:
return check_authorization
return passthru