xtn-tools-pro 1.0.0.0.9__py3-none-any.whl → 1.0.0.1.1__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- xtn_tools_pro/proxy/XiaoXiangProxy.py +28 -22
- {xtn_tools_pro-1.0.0.0.9.dist-info → xtn_tools_pro-1.0.0.1.1.dist-info}/METADATA +1 -1
- {xtn_tools_pro-1.0.0.0.9.dist-info → xtn_tools_pro-1.0.0.1.1.dist-info}/RECORD +6 -6
- {xtn_tools_pro-1.0.0.0.9.dist-info → xtn_tools_pro-1.0.0.1.1.dist-info}/LICENSE +0 -0
- {xtn_tools_pro-1.0.0.0.9.dist-info → xtn_tools_pro-1.0.0.1.1.dist-info}/WHEEL +0 -0
- {xtn_tools_pro-1.0.0.0.9.dist-info → xtn_tools_pro-1.0.0.1.1.dist-info}/top_level.txt +0 -0
@@ -151,23 +151,24 @@ class ProxyPool:
|
|
151
151
|
self.__log("获取小象代理报错:{e}".format(e=e))
|
152
152
|
|
153
153
|
def run(self):
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
self.
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
154
|
+
while True:
|
155
|
+
try:
|
156
|
+
# 手动绑定终端IP
|
157
|
+
response = requests.get(url=self.__XiaoXiangAutoBinding, verify=False, timeout=3)
|
158
|
+
self.__log(response.text)
|
159
|
+
while True:
|
160
|
+
# 检查代理
|
161
|
+
self.__check_proxy()
|
162
|
+
# 获取小象代理
|
163
|
+
self.__get_api_proxy()
|
164
|
+
time.sleep(1)
|
165
|
+
# 判断时间是否超过当前23:59分时间戳
|
166
|
+
if get_time_now_timestamp(is_time_10=True) >= self.__now_day59_timestamp:
|
167
|
+
self.__log("时间23:59,结束循环,{t}".format(t=int(time.time())))
|
168
|
+
break
|
169
|
+
except Exception as eee:
|
170
|
+
self.__log("程序异常报错:{eee}".format(eee=eee))
|
171
|
+
# self.__del__()
|
171
172
|
|
172
173
|
def get_proxy(self):
|
173
174
|
"""
|
@@ -195,13 +196,18 @@ class ProxyPool:
|
|
195
196
|
:return:
|
196
197
|
"""
|
197
198
|
try:
|
198
|
-
self.__redis_pool.
|
199
|
-
|
199
|
+
proxy_val_list = list(self.__redis_pool.get_all_key("{}*".format(self.__redisProxyName)))
|
200
|
+
for proxy_val in proxy_val_list:
|
201
|
+
if proxy_v in proxy_val:
|
202
|
+
self.__redis_pool.set(proxy_val, "999999")
|
203
|
+
self.__log("设置不可用的代理 {proxy_v} 为 999999".format(proxy_v=proxy_v))
|
204
|
+
return
|
200
205
|
except Exception as e:
|
201
206
|
self.__log("爬虫手动传入代理:{e}".format(e=e))
|
202
207
|
|
203
208
|
|
204
209
|
if __name__ == '__main__':
|
205
|
-
p = ProxyPool(ip="127.0.0.1", port=6379, db=0, user_pass="xtn-kk", XiaoXiangProxyAppKey="
|
206
|
-
XiaoXiangProxyAppSecret="
|
207
|
-
print(p.
|
210
|
+
p = ProxyPool(ip="127.0.0.1", port=6379, db=0, user_pass="xtn-kk", XiaoXiangProxyAppKey="1107231349661913088",
|
211
|
+
XiaoXiangProxyAppSecret="8kignGIX")
|
212
|
+
# print(p.set_proxy_error("http://49.83.105.188:32300"))
|
213
|
+
p.run()
|
@@ -6,7 +6,7 @@ xtn_tools_pro/db/MongoDB.py,sha256=zQLfZ-mhZWCFgY3dPF3dRAzAR3C8hrXO_yLZw9cUUUY,5
|
|
6
6
|
xtn_tools_pro/db/MysqlDB.py,sha256=SBJrcjbZdxmtTKPGwl57NthPhs4uX8J3P6o_rK01O4k,13373
|
7
7
|
xtn_tools_pro/db/RedisDB.py,sha256=ep32Yj8AAkUHRshSBhKsdl06UwO7Z-gQJLaezspVRKw,6053
|
8
8
|
xtn_tools_pro/db/__init__.py,sha256=Zg91UWS02TO0Ba_0AY56s0oabRy93xLNFkpIIL_6mMM,416
|
9
|
-
xtn_tools_pro/proxy/XiaoXiangProxy.py,sha256=
|
9
|
+
xtn_tools_pro/proxy/XiaoXiangProxy.py,sha256=G7awOFeBGAIYcyMMCcX90mgQbA7bfFn6YmwMa9DUD3o,10223
|
10
10
|
xtn_tools_pro/proxy/__init__.py,sha256=WRwh6s2lruMu5buh0ejo9EK54kWT_VQhCsFGNFAmcyo,418
|
11
11
|
xtn_tools_pro/proxy/proxy.py,sha256=No6E1pFY5yx2F4976pXPrLtq-QEVp79KupzcufjSN58,8703
|
12
12
|
xtn_tools_pro/utils/__init__.py,sha256=I1_n_NP23F2lBqlF4EOlnOdLYxM8M4pbn63UhJN1hRE,418
|
@@ -17,8 +17,8 @@ xtn_tools_pro/utils/log.py,sha256=8CRMiY7Q9LWGJLhfL0YfpANBwLets9f2qWfMOe5PpNM,81
|
|
17
17
|
xtn_tools_pro/utils/retry.py,sha256=0wjHsR5DBBKpv4naMfxiky8kprrZes4WURIfFQ4H708,1657
|
18
18
|
xtn_tools_pro/utils/sql.py,sha256=EAKzbkZP7Q09j15Gm6o0_uq0qgQmcCQT6EAawbpp4v0,6263
|
19
19
|
xtn_tools_pro/utils/time_utils.py,sha256=TUtzG61PeVYXhaQd6pBrXAdlz7tBispNIRQRcGhE2No,4859
|
20
|
-
xtn_tools_pro-1.0.0.
|
21
|
-
xtn_tools_pro-1.0.0.
|
22
|
-
xtn_tools_pro-1.0.0.
|
23
|
-
xtn_tools_pro-1.0.0.
|
24
|
-
xtn_tools_pro-1.0.0.
|
20
|
+
xtn_tools_pro-1.0.0.1.1.dist-info/LICENSE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
21
|
+
xtn_tools_pro-1.0.0.1.1.dist-info/METADATA,sha256=Gxj0V9FyVQjDxdhetSbfprPc6KxysVjYBpWGR0Ox-HE,431
|
22
|
+
xtn_tools_pro-1.0.0.1.1.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
23
|
+
xtn_tools_pro-1.0.0.1.1.dist-info/top_level.txt,sha256=jyB3FLDEr8zE1U7wHczTgIbvUpALhR-ULF7RVEO7O2U,14
|
24
|
+
xtn_tools_pro-1.0.0.1.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|