caidaoli commited on
Commit
b89b7b6
·
verified ·
1 Parent(s): 400ff8c

Update openai_ondemand_adapter.py

Browse files
Files changed (1) hide show
  1. openai_ondemand_adapter.py +5 -2
openai_ondemand_adapter.py CHANGED
@@ -14,7 +14,7 @@ SAFE_HEADERS = ["Authorization", "X-API-KEY"]
14
 
15
  # 全局接口访问权限检查
16
  def check_private_key():
17
- print("======== request.headers:", request.headers, "========")
18
 
19
  # 可以在这里放宽部分接口,比如首页等
20
  if request.path in ["/", "/favicon.ico"]:
@@ -27,7 +27,10 @@ def check_private_key():
27
  key = key[len("Bearer "):].strip()
28
  break
29
  if not key or key != PRIVATE_KEY:
30
- return jsonify({"error": "Unauthorized, must provide correct Authorization or X-API-KEY"}), 401
 
 
 
31
 
32
  # 应用所有API鉴权
33
  app = Flask(__name__)
 
14
 
15
  # 全局接口访问权限检查
16
  def check_private_key():
17
+
18
 
19
  # 可以在这里放宽部分接口,比如首页等
20
  if request.path in ["/", "/favicon.ico"]:
 
27
  key = key[len("Bearer "):].strip()
28
  break
29
  if not key or key != PRIVATE_KEY:
30
+ return jsonify({
31
+ "error": "Unauthorized, must provide correct Authorization or X-API-KEY",
32
+ "headers": dict(request.headers)
33
+ }), 401
34
 
35
  # 应用所有API鉴权
36
  app = Flask(__name__)