From 697c5394c203b030f2cba1ffdc0403d857d26cc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=B3=96=E9=9C=B2=E6=98=9F=E9=9C=9C=E2=80=A2=E6=9A=96?= =?UTF-8?q?=E9=9C=9E=E6=8B=BE=E5=85=89?= <2468001320@qq.com> Date: Thu, 13 Aug 2026 03:38:11 +0800 Subject: [PATCH] fix: replace bare except with except Exception (4 modules) --- src/modules/export/pdf.py | 2 +- src/modules/utils/file_operations.py | 2 +- src/modules/utils/http_client.py | 2 +- src/modules/utils/parse.py | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/modules/export/pdf.py b/src/modules/export/pdf.py index d66f6346..572bf72b 100644 --- a/src/modules/export/pdf.py +++ b/src/modules/export/pdf.py @@ -336,7 +336,7 @@ def saveToPdf(foundAccounts, resultType, config): height=35, ) y_position -= 15 - except: + except Exception: pass endWidth = y_position canva.setStrokeColor("#CE0000") diff --git a/src/modules/utils/file_operations.py b/src/modules/utils/file_operations.py index 0774e457..cb140678 100644 --- a/src/modules/utils/file_operations.py +++ b/src/modules/utils/file_operations.py @@ -10,5 +10,5 @@ def getLinesFromFile(fileName): with open(fileName) as f: lines = f.read().splitlines() return lines - except: + except Exception: return False diff --git a/src/modules/utils/http_client.py b/src/modules/utils/http_client.py index d9d8dd73..5bbdd7a2 100644 --- a/src/modules/utils/http_client.py +++ b/src/modules/utils/http_client.py @@ -65,7 +65,7 @@ async def do_async_request(method, url, session, config, data=None, customHeader json = None try: content = await response.text() - except: + except Exception: binaryContent = await response.read() encode = chardet.detect(binaryContent)["encoding"] content = binaryContent.decode(encode) diff --git a/src/modules/utils/parse.py b/src/modules/utils/parse.py index 5634b2bc..36f31119 100644 --- a/src/modules/utils/parse.py +++ b/src/modules/utils/parse.py @@ -16,7 +16,7 @@ def access_json_property(data, path_config): for key in path_config: property_value = property_value[key] return property_value - except: + except Exception: return False @@ -25,7 +25,7 @@ def access_html_regex(data, pattern): match = re.search(pattern, data) if match: return match.group(1).replace("\n", "") - except: + except Exception: return False