fix alipan u115 error log

This commit is contained in:
jxxghp
2025-09-08 17:13:01 +08:00
parent 4f304a70b7
commit d30b9282fd
2 changed files with 14 additions and 4 deletions

View File

@@ -252,6 +252,9 @@ class AliPan(StorageBase, metaclass=WeakSingleton):
# 检查会话
self._check_session()
# 错误日志控制
no_error_log = kwargs.pop("no_error_log", False)
try:
resp = self.session.request(
method, f"{self.base_url}{endpoint}",
@@ -274,7 +277,8 @@ class AliPan(StorageBase, metaclass=WeakSingleton):
# 返回数据
ret_data = resp.json()
if ret_data.get("code"):
logger.warn(f"【阿里云盘】{method} {endpoint} 返回:{ret_data.get('code')} {ret_data.get('message')}")
if not no_error_log:
logger.warn(f"【阿里云盘】{method} {endpoint} 返回:{ret_data.get('code')} {ret_data.get('message')}")
if result_key:
return ret_data.get(result_key)
@@ -825,7 +829,8 @@ class AliPan(StorageBase, metaclass=WeakSingleton):
json={
"drive_id": drive_id or self._default_drive_id,
"file_path": path.as_posix()
}
},
no_error_log=True
)
if not resp:
return None

View File

@@ -209,6 +209,9 @@ class U115Pan(StorageBase, metaclass=WeakSingleton):
# 检查会话
self._check_session()
# 错误日志标志
no_error_log = kwargs.pop("no_error_log", False)
try:
resp = self.session.request(
method, f"{self.base_url}{endpoint}",
@@ -238,7 +241,8 @@ class U115Pan(StorageBase, metaclass=WeakSingleton):
ret_data = resp.json()
if ret_data.get("code") != 0:
error_msg = ret_data.get("message")
logger.warn(f"【115】{method} 请求 {endpoint} 出错:{error_msg}")
if not no_error_log:
logger.warn(f"【115】{method} 请求 {endpoint} 出错:{error_msg}")
retry_times = kwargs.get("retry_limit", 5)
if "已达到当前访问上限" in error_msg:
if retry_times <= 0:
@@ -718,7 +722,8 @@ class U115Pan(StorageBase, metaclass=WeakSingleton):
"data",
data={
"path": path.as_posix()
}
},
no_error_log=True
)
if not resp:
return None