mdbq 4.0.36__py3-none-any.whl → 4.0.37__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
mdbq/__version__.py CHANGED
@@ -1 +1 @@
1
- VERSION = '4.0.36'
1
+ VERSION = '4.0.37'
@@ -79,13 +79,17 @@ def log_on_exception(
79
79
  log_fields: Optional[List[str]] = None,
80
80
  ):
81
81
  """
82
- :param logger: 日志对象
82
+ :param logger: 日志对象,需实现 debug/info/warning/error/critical 方法
83
83
  :param on_exception: 异常回调,参数为 error_info 字典
84
84
  :param default_return: 异常时返回的默认值
85
85
  :param log_fields: 只记录 error_info 的部分字段
86
86
  """
87
- if logger is not None and not isinstance(logger, logging.Logger):
88
- raise TypeError(f"logger 参数必须为 logging.Logger 实例或 None,当前类型为: {type(logger)}")
87
+ if logger is not None:
88
+ for method in ("debug", "info", "warning", "error", "critical"):
89
+ if not hasattr(logger, method):
90
+ raise TypeError(
91
+ f"logger 参数必须有 {method} 方法,当前类型为: {type(logger)}"
92
+ )
89
93
  def decorator(func):
90
94
  is_async = asyncio.iscoroutinefunction(func)
91
95
  @wraps(func)
@@ -142,13 +146,17 @@ def log_on_exception_with_retry(
142
146
  log_fields: Optional[List[str]] = None,
143
147
  ):
144
148
  """
145
- :param logger: 日志对象
149
+ :param logger: 日志对象,需实现 debug/info/warning/error/critical 方法
146
150
  :param on_exception: 异常回调,参数为 error_info 字典
147
151
  :param default_return: 异常时返回的默认值
148
152
  :param log_fields: 只记录 error_info 的部分字段
149
153
  """
150
- if logger is not None and not isinstance(logger, logging.Logger):
151
- raise TypeError(f"logger 参数必须为 logging.Logger 实例或 None,当前类型为: {type(logger)}")
154
+ if logger is not None:
155
+ for method in ("debug", "info", "warning", "error", "critical"):
156
+ if not hasattr(logger, method):
157
+ raise TypeError(
158
+ f"logger 参数必须有 {method} 方法,当前类型为: {type(logger)}"
159
+ )
152
160
  def decorator(func):
153
161
  is_async = asyncio.iscoroutinefunction(func)
154
162
  @wraps(func)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: mdbq
3
- Version: 4.0.36
3
+ Version: 4.0.37
4
4
  Home-page: https://pypi.org/project/mdbq
5
5
  Author: xigua,
6
6
  Author-email: 2587125111@qq.com
@@ -1,5 +1,5 @@
1
1
  mdbq/__init__.py,sha256=Il5Q9ATdX8yXqVxtP_nYqUhExzxPC_qk_WXQ_4h0exg,16
2
- mdbq/__version__.py,sha256=zkcTzC4btf-Gh2O0sS9u1Pl3m_UGMa4rkyfG91EfdD0,18
2
+ mdbq/__version__.py,sha256=1IAdkcLTP6Byg2amV6TPLMYX4EWf_WqqMKyIUbVRCfc,18
3
3
  mdbq/aggregation/__init__.py,sha256=EeDqX2Aml6SPx8363J-v1lz0EcZtgwIBYyCJV6CcEDU,40
4
4
  mdbq/aggregation/query_data.py,sha256=WtTFMN78jn43Y-nBTPAXhAK56w3wDuv_cj4YtzzGbZk,169797
5
5
  mdbq/log/__init__.py,sha256=Mpbrav0s0ifLL7lVDAuePEi1hJKiSHhxcv1byBKDl5E,15
@@ -14,7 +14,7 @@ mdbq/mysql/unique_.py,sha256=MaztT-WIyEQUs-OOYY4pFulgHVcXR1BfCy3QUz0XM_U,21127
14
14
  mdbq/mysql/uploader.py,sha256=SVlrLxoYBEpTu_I771wAehJQVFWOCqXp-lNk2JNYFOE,81881
15
15
  mdbq/other/__init__.py,sha256=jso1oHcy6cJEfa7udS_9uO5X6kZLoPBF8l3wCYmr5dM,18
16
16
  mdbq/other/download_sku_picture.py,sha256=X66sVdvVgzoNzmgVJyPtd7bjEvctEKtLPblEPF65EWc,46940
17
- mdbq/other/error_handler.py,sha256=XiygzLiOKy-pYE4xcMbF0cEFxKorHHAhSeVZIDbQvhY,12313
17
+ mdbq/other/error_handler.py,sha256=4p5haAXSY-P78stp4Xwo_MwAngWYqyKj5ogWIuYXMeY,12631
18
18
  mdbq/other/otk.py,sha256=iclBIFbQbhlqzUbcMMoePXBpcP1eZ06ZtjnhcA_EbmE,7241
19
19
  mdbq/other/pov_city.py,sha256=AEOmCOzOwyjHi9LLZWPKi6DUuSC-_M163664I52u9qw,21050
20
20
  mdbq/other/ua_sj.py,sha256=JuVYzc_5QZ9s_oQSrTHVKkQv4S_7-CWx4oIKOARn_9U,22178
@@ -25,7 +25,7 @@ mdbq/redis/__init__.py,sha256=YtgBlVSMDphtpwYX248wGge1x-Ex_mMufz4-8W0XRmA,12
25
25
  mdbq/redis/getredis.py,sha256=vpBuNc22uj9Vr-_Dh25_wpwWM1e-072EAAIBdB_IpL0,23494
26
26
  mdbq/spider/__init__.py,sha256=RBMFXGy_jd1HXZhngB2T2XTvJqki8P_Fr-pBcwijnew,18
27
27
  mdbq/spider/aikucun.py,sha256=XptHjGzbout9IYzWAOQUpMMV5qEgLTU8pL1ZGt8oNEA,21868
28
- mdbq-4.0.36.dist-info/METADATA,sha256=eyN-znN-wNE2_i3A5WsrJI7WnKXN6kUenvnQH2kqBHU,364
29
- mdbq-4.0.36.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
30
- mdbq-4.0.36.dist-info/top_level.txt,sha256=2FQ-uLnCSB-OwFiWntzmwosW3X2Xqsg0ewh1axsaylA,5
31
- mdbq-4.0.36.dist-info/RECORD,,
28
+ mdbq-4.0.37.dist-info/METADATA,sha256=PUJcSDuxE3fJkdK9-9ovfVDiCmFnwpd5HNuxblXBJC0,364
29
+ mdbq-4.0.37.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
30
+ mdbq-4.0.37.dist-info/top_level.txt,sha256=2FQ-uLnCSB-OwFiWntzmwosW3X2Xqsg0ewh1axsaylA,5
31
+ mdbq-4.0.37.dist-info/RECORD,,
File without changes