From fb1671ab0feb6621ea54901bc1d98c60b2ff733a Mon Sep 17 00:00:00 2001 From: hisatri Date: Mon, 7 Oct 2024 16:33:18 +0800 Subject: [PATCH] =?UTF-8?q?Fix=20#75=20=E5=A2=9E=E5=8A=A0=E9=89=B4?= =?UTF-8?q?=E6=9D=83=E5=AD=97=E6=AE=B5=E5=88=B0=E7=BC=93=E5=AD=98=E9=94=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/__init__.py | 11 +++++++---- api/lyrics.py | 1 - 2 files changed, 7 insertions(+), 5 deletions(-) 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