forked from jhao104/proxy_pool
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathProxyValidSchedule.py
54 lines (41 loc) · 1.18 KB
/
ProxyValidSchedule.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# -*- coding: utf-8 -*-
"""
-------------------------------------------------
File Name: ProxyValidSchedule.py
Description : 验证useful_proxy_queue中的代理,将不可用的移出
Author : JHao
date: 2017/3/31
-------------------------------------------------
Change Activity:
2017/3/31: 验证useful_proxy_queue中的代理
-------------------------------------------------
"""
__author__ = 'JHao'
import sys
sys.path.append('../')
from Schedule.ProxyCheck import ProxyCheck
class ProxyValidSchedule(object):
def __init__(self):
pass
def __validProxy(self, threads=5):
"""
验证useful_proxy代理
:param threads: 线程数
:return:
"""
thread_list = list()
for index in range(threads):
thread_list.append(ProxyCheck())
for thread in thread_list:
thread.daemon = True
thread.start()
for thread in thread_list:
thread.join()
def main(self):
self.__validProxy()
def run():
p = ProxyValidSchedule()
p.main()
if __name__ == '__main__':
p = ProxyValidSchedule()
p.main()