From 63775872c7ccc45788a0ce00fe8b741a0f38478b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=99=AF=E5=A4=A7=E4=BE=A0?= Date: Thu, 18 Sep 2025 15:59:52 +0800 Subject: [PATCH 1/4] =?UTF-8?q?fix=20TMDB=E5=9B=A0=E8=BF=9E=E6=8E=A5?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=E4=BA=A7=E7=94=9F=E7=9A=84NoneType=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit glitchtip#11 --- app/modules/themoviedb/tmdbapi.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/modules/themoviedb/tmdbapi.py b/app/modules/themoviedb/tmdbapi.py index 9830edca..eb844923 100644 --- a/app/modules/themoviedb/tmdbapi.py +++ b/app/modules/themoviedb/tmdbapi.py @@ -747,6 +747,9 @@ class TmdbApi: logger.info("正在从TheDbMovie网站查询:%s ..." % name) tmdb_url = self._build_tmdb_search_url(name) res = RequestUtils(timeout=5, ua=settings.NORMAL_USER_AGENT, proxies=settings.PROXY).get_res(url=tmdb_url) + if res is None: + logger.error("无法连接TheDbMovie") + return None # 响应验证 response_result = self._validate_response(res) @@ -1857,6 +1860,9 @@ class TmdbApi: tmdb_url = self._build_tmdb_search_url(name) res = await AsyncRequestUtils(timeout=5, ua=settings.NORMAL_USER_AGENT, proxies=settings.PROXY).get_res( url=tmdb_url) + if res is None: + logger.error("无法连接TheDbMovie") + return None # 响应验证 response_result = self._validate_response(res) From d4795bb897ffb81177ecdedf139a6a071c174a24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=99=AF=E5=A4=A7=E4=BE=A0?= Date: Thu, 18 Sep 2025 16:51:28 +0800 Subject: [PATCH 2/4] =?UTF-8?q?fix=20u115=E9=87=8D=E8=AF=95=E8=AF=B7?= =?UTF-8?q?=E6=B1=82=E6=97=B6=E6=8A=A5=E9=94=99unexpected=20keyword=20argu?= =?UTF-8?q?ment?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit glitchtip#136696 --- app/modules/filemanager/storages/u115.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/modules/filemanager/storages/u115.py b/app/modules/filemanager/storages/u115.py index f143af18..f4591e33 100644 --- a/app/modules/filemanager/storages/u115.py +++ b/app/modules/filemanager/storages/u115.py @@ -211,6 +211,8 @@ class U115Pan(StorageBase, metaclass=WeakSingleton): # 错误日志标志 no_error_log = kwargs.pop("no_error_log", False) + # 重试次数 + retry_times = kwargs.pop("retry_limit", 5) try: resp = self.session.request( @@ -225,6 +227,8 @@ class U115Pan(StorageBase, metaclass=WeakSingleton): logger.warn(f"【115】{method} 请求 {endpoint} 失败!") return None + kwargs["retry_limit"] = retry_times + # 处理速率限制 if resp.status_code == 429: reset_time = 5 + int(resp.headers.get("X-RateLimit-Reset", 60)) @@ -243,7 +247,6 @@ class U115Pan(StorageBase, metaclass=WeakSingleton): error_msg = ret_data.get("message") 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: logger.error(f"【115】{method} 请求 {endpoint} 达到访问上限,重试次数用尽!") From 9489730a44061dad23ae782cc18ce2450096482a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=99=AF=E5=A4=A7=E4=BE=A0?= Date: Thu, 18 Sep 2025 16:58:05 +0800 Subject: [PATCH 3/4] =?UTF-8?q?fix=20u115=E5=88=B7=E6=96=B0access=5Ftoken?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=E4=BC=9A=E4=BA=A7=E7=94=9FNoneType=E5=BC=82?= =?UTF-8?q?=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit glitchtip#49549 --- app/modules/filemanager/storages/u115.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/modules/filemanager/storages/u115.py b/app/modules/filemanager/storages/u115.py index f4591e33..844b903b 100644 --- a/app/modules/filemanager/storages/u115.py +++ b/app/modules/filemanager/storages/u115.py @@ -91,6 +91,8 @@ class U115Pan(StorageBase, metaclass=WeakSingleton): "refresh_time": int(time.time()), **tokens }) + else: + return None access_token = tokens.get("access_token") if access_token: self.session.headers.update({"Authorization": f"Bearer {access_token}"}) From 8bb3eaa32025f5675f5937e46e939caed2518374 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=99=AF=E5=A4=A7=E4=BE=A0?= Date: Thu, 18 Sep 2025 17:11:28 +0800 Subject: [PATCH 4/4] =?UTF-8?q?fix=20=E8=8E=B7=E5=8F=96=E4=B8=8A=E6=AC=A1?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=E7=BB=93=E6=9E=9C=E6=97=B6=E4=BA=A7=E7=94=9F?= =?UTF-8?q?=E7=9A=84NoneType=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit glitchtip#14 --- app/api/endpoints/search.py | 2 +- app/chain/search.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/api/endpoints/search.py b/app/api/endpoints/search.py index ec6a9e90..3854fb9b 100644 --- a/app/api/endpoints/search.py +++ b/app/api/endpoints/search.py @@ -20,7 +20,7 @@ async def search_latest(_: schemas.TokenPayload = Depends(verify_token)) -> Any: """ 查询搜索结果 """ - torrents = await SearchChain().async_last_search_results() + torrents = await SearchChain().async_last_search_results() or [] return [torrent.to_dict() for torrent in torrents] diff --git a/app/chain/search.py b/app/chain/search.py index 2f2f0fe3..dcf46864 100644 --- a/app/chain/search.py +++ b/app/chain/search.py @@ -86,13 +86,13 @@ class SearchChain(ChainBase): self.save_cache(contexts, self.__result_temp_file) return contexts - def last_search_results(self) -> List[Context]: + def last_search_results(self) -> Optional[List[Context]]: """ 获取上次搜索结果 """ return self.load_cache(self.__result_temp_file) - async def async_last_search_results(self) -> List[Context]: + async def async_last_search_results(self) -> Optional[List[Context]]: """ 异步获取上次搜索结果 """