优化代码结构 删除无用队列结果集参数

This commit is contained in:
shmilylty
2019-08-05 18:00:01 +08:00
parent 53213304e2
commit 11642edf6e
50 changed files with 332 additions and 502 deletions
+5 -8
View File
@@ -1,5 +1,4 @@
# coding=utf-8
import queue
import time
from common.query import Query
@@ -27,7 +26,7 @@ class Chinaz(Query):
subdomains_find = self.match(self.domain, resp.text)
self.subdomains = self.subdomains.union(subdomains_find) # 合并搜索子域名搜索结果
def run(self, rx_queue):
def run(self):
"""
类执行入口
"""
@@ -36,21 +35,19 @@ class Chinaz(Query):
self.save_json()
self.gen_result()
self.save_db()
rx_queue.put(self.results)
self.finish()
def do(domain, rx_queue): # 统一入口名字 方便多线程调用
def do(domain): # 统一入口名字 方便多线程调用
"""
类统一调用入口
:param str domain: 域名
:param rx_queue: 结果集队列
"""
query = Chinaz(domain)
query.run(rx_queue)
query.run()
if __name__ == '__main__':
result_queue = queue.Queue()
do('example.com', result_queue)
do('example.com')