lazysdk 0.1.90__py3-none-any.whl → 0.1.91__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.
lazysdk/lazywebhook.py CHANGED
@@ -6,6 +6,8 @@
6
6
  @ GitHub : https://github.com/ZeroSeeker
7
7
  @ Gitee : https://gitee.com/ZeroSeeker
8
8
  """
9
+ import time
10
+
9
11
  from lazysdk import lazyrequests
10
12
  import showlog
11
13
  import json
@@ -202,7 +204,9 @@ def send_text(
202
204
  at_ids: list = None,
203
205
  at_mobiles: list = None,
204
206
  is_at: bool = None,
205
- at_all: bool = None
207
+ at_all: bool = None,
208
+ ensure_success: bool = False,
209
+ ensure_success_limit: int = 60
206
210
  ):
207
211
  """
208
212
  在内部实例化,
@@ -233,14 +237,26 @@ def send_text(
233
237
  webhook_hostname = urlparse(webhook).hostname
234
238
  if webhook_hostname == 'qyapi.weixin.qq.com':
235
239
  webhook_basic = WeixinBasics(con_info=con_info)
236
- response = webhook_basic.send_text(
237
- msg=msg,
238
- con_info=con_info,
239
- at_ids=at_ids,
240
- at_mobiles=at_mobiles,
241
- is_at=is_at,
242
- at_all=at_all
243
- )
244
- return response
240
+ retry_count = 0
241
+ while True:
242
+ response = webhook_basic.send_text(
243
+ msg=msg,
244
+ con_info=con_info,
245
+ at_ids=at_ids,
246
+ at_mobiles=at_mobiles,
247
+ is_at=is_at,
248
+ at_all=at_all
249
+ )
250
+ if not ensure_success:
251
+ return response
252
+ else:
253
+ if response.get('errcode') == 0:
254
+ return response
255
+ else:
256
+ showlog.warning(response)
257
+ retry_count += 1
258
+ if retry_count > ensure_success_limit:
259
+ return response
260
+ time.sleep(1)
245
261
  else:
246
262
  return {'errcode': -2, 'errmsg': '暂不支持此webhook'}
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lazysdk
3
- Version: 0.1.90
3
+ Version: 0.1.91
4
4
  Summary: 基于Python的懒人包
5
5
  Home-page: https://gitee.com/ZeroSeeker/lazysdk
6
6
  Author: ZeroSeeker
@@ -28,12 +28,12 @@ lazysdk/lazytext.py,sha256=uyfXscNNqbozLrHm-mmIzf-CGG158qBsN3MJhimWROQ,2627
28
28
  lazysdk/lazytime.py,sha256=3GHfck89GNg556gYCoCd5NpntybBU848gJ1Udv1jikk,26530
29
29
  lazysdk/lazyua.py,sha256=IqLmqGDECdJa3Wcr8h6sTxMErJZlCTM3Jk7IWm90UzI,4827
30
30
  lazysdk/lazyurl.py,sha256=N89QLK2A6vXr9gqp-9vnk9RXv_fOjw171lVl9eEoxtE,1550
31
- lazysdk/lazywebhook.py,sha256=HwJIZ5j3wUpnEfPkFY-Xq9T_9xdhCJ71dYsWNX22_3Y,8386
31
+ lazysdk/lazywebhook.py,sha256=1YEerujxnAOgj1F4R-IX2juZDa5o_AFWgEp4gO92_60,8937
32
32
  lazysdk/lazywifi.py,sha256=FOvLPTcb6BQE6D8kjfB0TLpfgGxw8jqC3vZbTs6LbD4,716
33
33
  lazysdk/lazyxml.py,sha256=PLAcDWjpu2GMJPsV9dHOv716CVmflQee7Aan-hqGxL8,770
34
34
  lazysdk/showdata.py,sha256=957JMXq7qfJ4ELpA3nBJwkyEUn6mRwtVXVBGYfZaCgg,1683
35
- lazysdk-0.1.90.dist-info/LICENSE,sha256=OC5E4ENUG6B4dGEVGwUpdsD-D9SZsCVC92NAgaqvE-c,1088
36
- lazysdk-0.1.90.dist-info/METADATA,sha256=mRoUG-HcSo4tKAAL-VMCqCqFxBO7QHMmFtLOB4cc7wc,1912
37
- lazysdk-0.1.90.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
38
- lazysdk-0.1.90.dist-info/top_level.txt,sha256=--bGS42ZHUhVeO83y1wfvKFg6OjkTLxQ4V4riqPQljY,8
39
- lazysdk-0.1.90.dist-info/RECORD,,
35
+ lazysdk-0.1.91.dist-info/LICENSE,sha256=OC5E4ENUG6B4dGEVGwUpdsD-D9SZsCVC92NAgaqvE-c,1088
36
+ lazysdk-0.1.91.dist-info/METADATA,sha256=V7id0uyf9gECHDyBub25T6zoWDrxUlV7cB5fcx91kqM,1912
37
+ lazysdk-0.1.91.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
38
+ lazysdk-0.1.91.dist-info/top_level.txt,sha256=--bGS42ZHUhVeO83y1wfvKFg6OjkTLxQ4V4riqPQljY,8
39
+ lazysdk-0.1.91.dist-info/RECORD,,