diff --git a/api/__init__.py b/api/__init__.py index d2e5544..32a70b2 100644 --- a/api/__init__.py +++ b/api/__init__.py @@ -29,10 +29,13 @@ # 缓存键,解决缓存未忽略参数的情况 -def make_cache_key(*args, **kwargs): - path = request.path - args = str(hash(frozenset(request.args.items()))) - return path + args +def make_cache_key(*args, **kwargs) -> str: + path:str = request.path + args:str = str(hash(frozenset(request.args.items()))) + auth_key:str = str(request.headers.get('Authorization', '') + or request.headers.get('Authentication', '')) + cookie:str = str(request.cookies.get('api_auth_token', '')) + return path + args + auth_key + cookie def get_base_path(): diff --git a/api/lyrics.py b/api/lyrics.py index 740f435..66d6d76 100644 --- a/api/lyrics.py +++ b/api/lyrics.py @@ -1,7 +1,6 @@ from . import * import os -import concurrent.futures from flask import request, abort, jsonify, render_template_string from urllib.parse import unquote_plus