mirror of
https://github.com/shmilylty/OneForAll.git
synced 2026-08-26 04:47:48 +08:00
修复reason记录问题
This commit is contained in:
@@ -142,11 +142,12 @@ def get_title(markup):
|
||||
|
||||
def request_callback(future, index, datas):
|
||||
result = future.result()
|
||||
if isinstance(result, Exception):
|
||||
if isinstance(result, BaseException):
|
||||
logger.log('TRACE', result.args)
|
||||
datas[index]['reason'] = str(result.args)
|
||||
name = utils.get_classname(result)
|
||||
datas[index]['reason'] = name + ' ' + str(result)
|
||||
datas[index]['valid'] = 0
|
||||
if isinstance(result, tuple):
|
||||
elif isinstance(result, tuple):
|
||||
resp, text = result
|
||||
datas[index]['reason'] = resp.reason
|
||||
datas[index]['status'] = resp.status
|
||||
@@ -163,9 +164,6 @@ def request_callback(future, index, datas):
|
||||
datas[index]['title'] = utils.remove_string(title)
|
||||
datas[index]['header'] = str(dict(headers))[1:-1]
|
||||
datas[index]['response'] = utils.remove_string(text)
|
||||
else:
|
||||
datas[index]['reason'] = str(result)
|
||||
datas[index]['valid'] = 0
|
||||
|
||||
|
||||
def get_connector():
|
||||
|
||||
@@ -6,6 +6,7 @@ import tqdm
|
||||
from dns.resolver import Resolver
|
||||
|
||||
import config
|
||||
from common import utils
|
||||
from config import logger
|
||||
|
||||
|
||||
@@ -65,15 +66,14 @@ def resolve_callback(future, index, datas):
|
||||
:param datas: 结果集
|
||||
"""
|
||||
hostname, answer = future.result()
|
||||
if isinstance(answer, Exception):
|
||||
datas[index]['reason'] = str(answer.args)
|
||||
if isinstance(answer, BaseException):
|
||||
logger.log('TRACE', answer.args)
|
||||
name = utils.get_classname(answer)
|
||||
datas[index]['reason'] = name + ' ' + str(answer)
|
||||
datas[index]['valid'] = 0
|
||||
if isinstance(answer, tuple):
|
||||
elif isinstance(answer, tuple):
|
||||
ips = answer[2]
|
||||
datas[index]['ips'] = str(ips)[1:-1]
|
||||
else:
|
||||
datas[index]['reason'] = str(answer)
|
||||
datas[index]['valid'] = 0
|
||||
|
||||
|
||||
async def bulk_query_a(datas):
|
||||
|
||||
@@ -282,3 +282,7 @@ def export_all(format, datas):
|
||||
|
||||
def get_timestamp():
|
||||
return int(time.time())
|
||||
|
||||
|
||||
def get_classname(clsobj):
|
||||
return clsobj.__class__.__name__
|
||||
|
||||
Reference in New Issue
Block a user