From 6b182a441ac1a324470de0d901c7b8725609068a Mon Sep 17 00:00:00 2001 From: thsrite Date: Mon, 19 May 2025 15:06:00 +0800 Subject: [PATCH] fix date format --- plugins/lucky/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/lucky/__init__.py b/plugins/lucky/__init__.py index 60e785d..fb78563 100644 --- a/plugins/lucky/__init__.py +++ b/plugins/lucky/__init__.py @@ -86,7 +86,11 @@ class Lucky(_PluginBase): response = requests.get(ssl_url, verify=False) # 关闭SSL证书验证 response.raise_for_status() # 如果状态码不是 2xx,抛出异常 if response.json().get('ret') == 0: - return response.json().get('list')[0].get('CertsInfo')[0].get('NotAfterTime') + try: + return response.json().get('list')[0].get('CertsInfo')[0].get('NotAfterTime') + except Exception as e: + return response.json().get('list')[0].get('CertsInfo', {}).get('NotAfterTime') + return None except Exception as e: logging.error("An error occurred:", e) return None