-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
41 lines (34 loc) · 1.1 KB
/
main.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
import threading
from xc import xc
from request import base
from api import api
from kd import kd
class main:
def __init__(self):
base()
self.thread_pool = []
self.urls = {
"kd_intr": "http://www.kuaidaili.com/free/intr/",
"kd_inha": "http://www.kuaidaili.com/free/inha/",
'xc_http': 'http://www.xicidaili.com/wt/',
'xc_https': 'http://www.xicidaili.com/wn/',
'route_showapi': "http://route.showapi.com/22-1"
}
self.functions = {
'xc': xc(),
'route': api(),
'kd': kd()
}
def run(self):
for key, url in self.urls.items():
fc = self.functions[key.split('_')[0]]
thread = threading.Thread(target=fc.run, args=(url,))
thread.name = "线程" + key
self.thread_pool.append(thread)
for thread in self.thread_pool:
thread.start()
for thread in self.thread_pool:
thread.join()
if __name__ == "__main__":
main = main()
main.run()