@@ -142,8 +142,8 @@ def jm_get(self, url, is_api=True, require_200=True, **kwargs):
142142 f'响应文本过长(len={ len (resp .text )} ),不打印' )
143143 )
144144
145- if is_api is True and resp . text . strip () == JmModuleConfig . JM_SERVER_ERROR_HTML :
146- raise AssertionError ( "【JM异常】Could not connect to mysql! Please check your database settings!" )
145+ if is_api is True :
146+ JmModuleConfig . check_html ( resp . text . strip (), url )
147147
148148 return resp
149149
@@ -158,7 +158,7 @@ def img_is_not_need_to_decode(cls, data_original: str, _resp):
158158 return data_original .endswith ('.gif' )
159159
160160 # noinspection PyAttributeOutsideInit
161- def enable_cache (self ):
161+ def enable_cache (self , debug = False ):
162162 def wrap_func_cache (func_name , cache_dict_name ):
163163 if hasattr (self , cache_dict_name ):
164164 return
@@ -168,10 +168,14 @@ def wrap_func_cache(func_name, cache_dict_name):
168168
169169 # 重载本对象的方法
170170 func = getattr (self , func_name )
171+
172+ cache_hit_msg = f'【缓存命中】{ cache_dict_name } ' + '→ [{}]' if debug is True else None
173+ cache_miss_msg = f'【缓存缺失】{ cache_dict_name } ' + '← [{}]' if debug is True else None
174+
171175 wrap_func = enable_cache (
172176 cache_dict = cache_dict ,
173- cache_hit_msg = f'命中 { cache_dict_name } ' + '→ [{}]]' ,
174- cache_miss_msg = f'缺失 { cache_dict_name } ' + '← [{}]' ,
177+ cache_hit_msg = cache_hit_msg ,
178+ cache_miss_msg = cache_miss_msg ,
175179 )(func )
176180
177181 setattr (self , func_name , wrap_func )
0 commit comments