mns-common 1.3.9.5__py3-none-any.whl → 1.3.9.6__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.

Potentially problematic release.


This version of mns-common might be problematic. Click here for more details.

@@ -7,7 +7,6 @@ project_path = file_path[0:end]
7
7
  sys.path.append(project_path)
8
8
 
9
9
  import mns_common.api.proxies.liu_guan_proxy_api as liu_guan_proxy_api
10
- from functools import lru_cache
11
10
  import pandas as pd
12
11
  import mns_common.utils.data_frame_util as data_frame_util
13
12
  from mns_common.db.MongodbUtil import MongodbUtil
@@ -17,23 +16,26 @@ import datetime
17
16
  mongodb_util = MongodbUtil('27017')
18
17
 
19
18
 
20
- @lru_cache(maxsize=None)
21
19
  def query_liu_guan_proxy_ip():
22
20
  ip_proxy_pool = mongodb_util.find_all_data(db_name_constant.IP_PROXY_POOL)
23
21
  return ip_proxy_pool
24
22
 
25
23
 
26
- def clear_proxy_ip_cache():
27
- query_liu_guan_proxy_ip.cache_clear()
24
+ def remove_proxy_ip():
28
25
  mongodb_util.remove_data({}, db_name_constant.IP_PROXY_POOL)
29
26
 
30
27
 
31
- def check_valid(str_now_date, ip_proxy_pool):
28
+ def check_valid(ip_proxy_pool):
32
29
  effect_time = list(ip_proxy_pool['effect_time'])[0]
30
+
31
+ now_date = datetime.datetime.now()
32
+
33
+ str_now_date = now_date.strftime('%Y-%m-%d %H:%M:%S')
34
+
33
35
  if effect_time > str_now_date:
34
36
  return True
35
37
  else:
36
- clear_proxy_ip_cache()
38
+ remove_proxy_ip()
37
39
  return False
38
40
 
39
41
 
@@ -48,7 +50,7 @@ def generate_proxy_ip(minutes):
48
50
  secret = list(stock_account_info['account'])[0]
49
51
 
50
52
  now_date = datetime.datetime.now()
51
- time_to_add = datetime.timedelta(minutes=minutes - 1, seconds=50)
53
+ time_to_add = datetime.timedelta(minutes=minutes - 1, seconds=30)
52
54
  new_date = now_date + time_to_add
53
55
  str_now_date = new_date.strftime('%Y-%m-%d %H:%M:%S')
54
56
 
@@ -65,20 +67,21 @@ def generate_proxy_ip(minutes):
65
67
  return ip
66
68
 
67
69
 
68
- def get_proxy_ip(str_now_date, minutes):
70
+ def get_proxy_ip( minutes):
69
71
  ip_proxy_pool = query_liu_guan_proxy_ip()
70
72
  if data_frame_util.is_empty(ip_proxy_pool):
71
73
  return generate_proxy_ip(minutes)
72
74
  else:
73
- if check_valid(str_now_date, ip_proxy_pool):
75
+ if check_valid( ip_proxy_pool):
74
76
  return list(ip_proxy_pool['ip'])[0]
75
77
  else:
76
78
  return generate_proxy_ip(minutes)
77
79
 
78
80
 
79
81
  if __name__ == '__main__':
82
+ get_proxy_ip(1)
80
83
  while True:
81
- now_date = datetime.datetime.now()
82
- str_now_date_test = now_date.strftime('%Y-%m-%d %H:%M:%S')
84
+ now_date_test = datetime.datetime.now()
85
+ str_now_date_test = now_date_test.strftime('%Y-%m-%d %H:%M:%S')
83
86
  ip_test = get_proxy_ip(str_now_date_test)
84
87
  print(ip_test)
@@ -1,4 +1,4 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mns-common
3
- Version: 1.3.9.5
3
+ Version: 1.3.9.6
4
4
 
@@ -113,7 +113,7 @@ mns_common/component/k_line/patterns/pattern_Enum.py,sha256=bl8cH1H3BWdj_deVO124
113
113
  mns_common/component/price/__init__.py,sha256=wEg73KlZo-dU0yKGwpA1C2y6LZm4IBb94tNda1tqLeg,163
114
114
  mns_common/component/price/trade_price_service_api.py,sha256=0loBjbOt__o-ngc2Q4n5lF8_0x2WINRpL-cH1341Uaw,4396
115
115
  mns_common/component/proxies/__init__.py,sha256=wEg73KlZo-dU0yKGwpA1C2y6LZm4IBb94tNda1tqLeg,163
116
- mns_common/component/proxies/proxy_common_api.py,sha256=BOcxXuGf_f-uO-7YtvRNxsiOqcZYL1RQc-AN7FfMm4w,2782
116
+ mns_common/component/proxies/proxy_common_api.py,sha256=8wluf_DcXw6098mflBdYg-hMJs2is0mmQ3dUhVH1wRE,2766
117
117
  mns_common/component/qmt/__init__.py,sha256=wEg73KlZo-dU0yKGwpA1C2y6LZm4IBb94tNda1tqLeg,163
118
118
  mns_common/component/qmt/qmt_buy_service.py,sha256=tLTgrSxCcxuMhADRBBrW4ZWR_3MdbMZvvMdH5hbwyJU,7190
119
119
  mns_common/component/real_time/__init__.py,sha256=2U9DiKslxsWwLLEcZKjS8UiQPN1QgALvnK3HiJNIZE0,163
@@ -152,7 +152,7 @@ mns_common/utils/date_handle_util.py,sha256=XS-MyA8_7k35LOCFAYOHgVcVkMft_Kc4Wa9U
152
152
  mns_common/utils/db_util.py,sha256=hSmfNAN4vEeEaUva6_cicZEhb2jSnib-Gvk2reke1vc,2590
153
153
  mns_common/utils/file_util.py,sha256=egWu6PenGPRp_ixrNTHKarT4dAnOT6FETR82EHUZJnQ,1042
154
154
  mns_common/utils/ip_util.py,sha256=UTcYfz_uytB__6nlBf7T-izuI7hi4XdB6ET0sJgEel4,969
155
- mns_common-1.3.9.5.dist-info/METADATA,sha256=6DZl56rzqq3c_HXEF_YoH-1sugm3IjSGv58U7x98WJ4,61
156
- mns_common-1.3.9.5.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
157
- mns_common-1.3.9.5.dist-info/top_level.txt,sha256=ZC58kAR-8Hvc6U2xhYNBNLAh3mb6sZazbdj5nZpvEkQ,11
158
- mns_common-1.3.9.5.dist-info/RECORD,,
155
+ mns_common-1.3.9.6.dist-info/METADATA,sha256=Ykn8ZcZSGRcg99tbleCm3lcWdbPUoeQTYHHtMPbRDf4,61
156
+ mns_common-1.3.9.6.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
157
+ mns_common-1.3.9.6.dist-info/top_level.txt,sha256=ZC58kAR-8Hvc6U2xhYNBNLAh3mb6sZazbdj5nZpvEkQ,11
158
+ mns_common-1.3.9.6.dist-info/RECORD,,