lazysdk 0.1.111__py3-none-any.whl → 0.1.112__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/lazy_header.py ADDED
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env python3
2
+ # coding = utf8
3
+ from lazysdk import showdata
4
+
5
+ def convert2dict(header_str: str):
6
+ header_temp = header_str.split('\n')
7
+ header_dict = dict()
8
+ for each in header_temp:
9
+ if len(each) == 0:
10
+ continue
11
+ else:
12
+ each_split = each.split(': ')
13
+ header_dict[each_split[0]] = each_split[1]
14
+ return header_dict
15
+
16
+
17
+ def get_lines():
18
+ lines = []
19
+ print("请输入多行数据,以空行结束:")
20
+ while True:
21
+ line = input()
22
+ if line:
23
+ lines.append(line)
24
+ else:
25
+ break
26
+
27
+ print("您输入的多行数据是:")
28
+ return "\n".join(lines)
29
+
30
+
31
+ if __name__ == '__main__':
32
+ test_lines = get_lines()
33
+ showdata.show_dict(convert2dict(header_str=test_lines))
34
+
lazysdk/lazyrequests.py CHANGED
@@ -23,7 +23,8 @@ def lazy_requests(
23
23
  ReadTimeout_retry: bool = True, # 超时重试
24
24
  JSONDecodeError_retry: bool = True, # 返回非json类型重试
25
25
  ConnectionError_retry: bool = True, # 连接错误重试
26
- ChunkedEncodingError: bool = True,
26
+ ChunkedEncodingError_retry: bool = True,
27
+ TooManyRedirects_retry: bool = True,
27
28
 
28
29
  **kwargs
29
30
  ):
@@ -53,22 +54,27 @@ def lazy_requests(
53
54
  except requests.exceptions.ReadTimeout:
54
55
  if ReadTimeout_retry is True:
55
56
  retry_count += 1
56
- showlog.warning(f'ReadTimeout_retry,将在{retry_delay}秒后重试第{retry_count}次...')
57
+ showlog.warning(f'ReadTimeout,将在{retry_delay}秒后重试第{retry_count}次...')
57
58
  time.sleep(retry_delay)
58
59
  except requests.exceptions.JSONDecodeError:
59
60
  if JSONDecodeError_retry is True:
60
61
  retry_count += 1
61
- showlog.warning(f'JSONDecodeError_retry,将在{retry_delay}秒后重试第{retry_count}次...')
62
+ showlog.warning(f'JSONDecodeError,将在{retry_delay}秒后重试第{retry_count}次...')
62
63
  time.sleep(retry_delay)
63
64
  except requests.exceptions.ConnectionError: # 包含ProxyError
64
65
  if ConnectionError_retry is True:
65
66
  retry_count += 1
66
- showlog.warning(f'ConnectionError_retry,将在{retry_delay}秒后重试第{retry_count}次...')
67
+ showlog.warning(f'ConnectionError,将在{retry_delay}秒后重试第{retry_count}次...')
67
68
  time.sleep(retry_delay)
68
69
  except requests.exceptions.ChunkedEncodingError:
69
- if ChunkedEncodingError is True:
70
+ if ChunkedEncodingError_retry is True:
70
71
  retry_count += 1
71
- showlog.warning(f'ChunkedEncodingError_retry,将在{retry_delay}秒后重试第{retry_count}次...')
72
+ showlog.warning(f'ChunkedEncodingError,将在{retry_delay}秒后重试第{retry_count}次...')
73
+ time.sleep(retry_delay)
74
+ except requests.exceptions.TooManyRedirects:
75
+ if TooManyRedirects_retry is True:
76
+ retry_count += 1
77
+ showlog.warning(f'TooManyRedirects,将在{retry_delay}秒后重试第{retry_count}次...')
72
78
  time.sleep(retry_delay)
73
79
  if retry_limit == 0:
74
80
  break
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lazysdk
3
- Version: 0.1.111
3
+ Version: 0.1.112
4
4
  Summary: 基于Python的懒人包
5
5
  Home-page: https://gitee.com/ZeroSeeker/lazysdk
6
6
  Author: ZeroSeeker
@@ -1,5 +1,6 @@
1
1
  lazysdk/__init__.py,sha256=DnzFWyjDsoyNGq0VJ_s0Ha6dPOIGrZtA3DFQhg0HbEU,184
2
2
  lazysdk/lazyCrypto.py,sha256=OftFbJTzPgoQ-o2AI4LI6uyPNIZAp0XZnXl_qStnR78,389
3
+ lazysdk/lazy_header.py,sha256=Ias8LAIOg5iUXGFsyNwdQ7QcAgcR7pp-q29ZFiCH1xU,782
3
4
  lazysdk/lazy_id_card.py,sha256=b96SvObDaEavMLIdinbxpleupCEnHihklO-jycl5BJ8,2797
4
5
  lazysdk/lazybase64.py,sha256=8jtuH9S1jICXpzxhRLe7xNur_o9TWbT1BRmTshZWYh0,669
5
6
  lazysdk/lazycache.py,sha256=it4B-iTXITtua8yjeiUooDsye4Z_aGy4uAOibxoViNQ,571
@@ -24,7 +25,7 @@ lazysdk/lazyproxies.py,sha256=bljLKkP3WksZ6jOHhjS5-jSHdUBRH6gx-BxEZTPJeXc,546
24
25
  lazysdk/lazyrandom.py,sha256=XZ8hTcNvc68FAI-BfaIt7QpCmzZ7m4RGDrfpy_U7zTw,1420
25
26
  lazysdk/lazyre.py,sha256=UQNpf9P1GyxRoRfuulyY4D1nnF227R4bzUGT3LevE7w,956
26
27
  lazysdk/lazyredis.py,sha256=78jM_tXNgUKULcp08CQEHmfAlzwlWuOsl6SuLwoLDdM,37918
27
- lazysdk/lazyrequests.py,sha256=qOUNkFhIThHNLALDTmOqPjKgMse5BVD-Kf9kheadMAY,3750
28
+ lazysdk/lazyrequests.py,sha256=kNtHmg-M39selgsOtdGb-6KHfAz80BE3IwdcTdrJth4,4065
28
29
  lazysdk/lazytext.py,sha256=1UgwxLt3c6i0JwUGRC7srSc_mhM3ICv1WrhOqkuIrLk,2672
29
30
  lazysdk/lazytime.py,sha256=uT6Q00XNPYifMgig0uTLmCRRBnqpciSfy96QoVbrQK4,27383
30
31
  lazysdk/lazyua.py,sha256=IqLmqGDECdJa3Wcr8h6sTxMErJZlCTM3Jk7IWm90UzI,4827
@@ -33,8 +34,8 @@ lazysdk/lazywebhook.py,sha256=DWn4AE4E_w2wZuev5aD51J5oGCJjitbucFokHSSnuHg,9377
33
34
  lazysdk/lazywifi.py,sha256=FOvLPTcb6BQE6D8kjfB0TLpfgGxw8jqC3vZbTs6LbD4,716
34
35
  lazysdk/lazyxml.py,sha256=PLAcDWjpu2GMJPsV9dHOv716CVmflQee7Aan-hqGxL8,770
35
36
  lazysdk/showdata.py,sha256=957JMXq7qfJ4ELpA3nBJwkyEUn6mRwtVXVBGYfZaCgg,1683
36
- lazysdk-0.1.111.dist-info/LICENSE,sha256=OC5E4ENUG6B4dGEVGwUpdsD-D9SZsCVC92NAgaqvE-c,1088
37
- lazysdk-0.1.111.dist-info/METADATA,sha256=BQeIitV7HwNlYnsKZosy1mfIjxeItG1z1PM8L-6pkH4,1901
38
- lazysdk-0.1.111.dist-info/WHEEL,sha256=iAkIy5fosb7FzIOwONchHf19Qu7_1wCWyFNR5gu9nU0,91
39
- lazysdk-0.1.111.dist-info/top_level.txt,sha256=--bGS42ZHUhVeO83y1wfvKFg6OjkTLxQ4V4riqPQljY,8
40
- lazysdk-0.1.111.dist-info/RECORD,,
37
+ lazysdk-0.1.112.dist-info/LICENSE,sha256=OC5E4ENUG6B4dGEVGwUpdsD-D9SZsCVC92NAgaqvE-c,1088
38
+ lazysdk-0.1.112.dist-info/METADATA,sha256=EHtJD_o_24hYL-O33IAFntL7MtHxmr6pDjozMIpyq0Y,1901
39
+ lazysdk-0.1.112.dist-info/WHEEL,sha256=iAkIy5fosb7FzIOwONchHf19Qu7_1wCWyFNR5gu9nU0,91
40
+ lazysdk-0.1.112.dist-info/top_level.txt,sha256=--bGS42ZHUhVeO83y1wfvKFg6OjkTLxQ4V4riqPQljY,8
41
+ lazysdk-0.1.112.dist-info/RECORD,,