forked from FelixZFB/ProxiesPool
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
38 lines (29 loc) · 857 Bytes
/
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
# -*- coding:utf-8 -*-
# project_xxx\venv\Scripts python
'''
Author: Felix
Email: [email protected]
Blog: https://blog.csdn.net/u011318077
Date: 2019/9/23 20:44
Desc: 主进程调度器
'''
from multiprocessing import Process
from Crawler.check_crawl_ip import CheckIp, CrawlIp
from api import run
def proxy_run():
# 数据库中ip检测进程
check_process = Process(target=CheckIp().check)
# 爬取ip代理的进程
crawl_process = Process(target=CrawlIp().crawl)
# api接口进程,用于从数据库中取出一个或者全部ip代理
run_process = Process(target=run)
# 启动所有进程
check_process.start()
crawl_process.start()
run_process.start()
# 等待所有进程结束
check_process.join()
crawl_process.join()
run_process.join()
if __name__ == '__main__':
proxy_run()