mirror of
https://github.com/shmilylty/OneForAll.git
synced 2026-10-28 03:35:51 +08:00
优化请求
This commit is contained in:
+1
-1
@@ -208,7 +208,7 @@ def save(name, total, req_data, resp_queue):
|
|||||||
new_info = gen_new_info(old_info, resp)
|
new_info = gen_new_info(old_info, resp)
|
||||||
db.insert_table(name, new_info)
|
db.insert_table(name, new_info)
|
||||||
resp_queue.task_done()
|
resp_queue.task_done()
|
||||||
if i >= total:
|
if i >= total: # 得存入完所有请求结果才能结束
|
||||||
break
|
break
|
||||||
db.close()
|
db.close()
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -1,3 +1,4 @@
|
|||||||
|
import os
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
@@ -476,7 +477,7 @@ def ip_is_public(ip_str):
|
|||||||
|
|
||||||
|
|
||||||
def get_request_count():
|
def get_request_count():
|
||||||
return 32
|
return os.cpu_count() * 16
|
||||||
|
|
||||||
|
|
||||||
def uniq_dict_list(dict_list):
|
def uniq_dict_list(dict_list):
|
||||||
|
|||||||
+2
-2
@@ -97,8 +97,8 @@ request_proxy_pool = [{'http': 'http://127.0.0.1:1080',
|
|||||||
|
|
||||||
|
|
||||||
# 请求设置
|
# 请求设置
|
||||||
request_thread_count = None # 请求线程数量(默认None,则根据内存大小设置)
|
request_thread_count = None # 请求线程数量(默认None,则根据情况自动设置)
|
||||||
request_timeout_second = (3.05, 27) # 请求超时秒数(默认connect timout推荐略大于3秒,read秒)
|
request_timeout_second = (3.05, 27) # 请求超时秒数(默认connect timout推荐略大于3秒)
|
||||||
request_ssl_verify = False # 请求SSL验证(默认False)
|
request_ssl_verify = False # 请求SSL验证(默认False)
|
||||||
request_allow_redirect = True # 请求允许重定向(默认True)
|
request_allow_redirect = True # 请求允许重定向(默认True)
|
||||||
request_redirect_limit = 10 # 请求跳转限制(默认10次)
|
request_redirect_limit = 10 # 请求跳转限制(默认10次)
|
||||||
|
|||||||
@@ -71,6 +71,30 @@ request_proxy_pool = [{'http': 'http://127.0.0.1:1080',
|
|||||||
# request_proxy_pool = [{'http': 'socks5h://127.0.0.1:10808',
|
# request_proxy_pool = [{'http': 'socks5h://127.0.0.1:10808',
|
||||||
# 'https': 'socks5h://127.0.0.1:10808'}] # 代理池
|
# 'https': 'socks5h://127.0.0.1:10808'}] # 代理池
|
||||||
|
|
||||||
|
|
||||||
|
# 请求设置
|
||||||
|
request_thread_count = None # 请求线程数量(默认None,则根据情况自动设置)
|
||||||
|
request_timeout_second = (3.05, 27) # 请求超时秒数(默认connect timout推荐略大于3秒)
|
||||||
|
request_ssl_verify = False # 请求SSL验证(默认False)
|
||||||
|
request_allow_redirect = True # 请求允许重定向(默认True)
|
||||||
|
request_redirect_limit = 10 # 请求跳转限制(默认10次)
|
||||||
|
# 默认请求头 可以在headers里添加自定义请求头
|
||||||
|
request_default_headers = {
|
||||||
|
'Accept': 'text/html,application/xhtml+xml,'
|
||||||
|
'application/xml;q=0.9,*/*;q=0.8',
|
||||||
|
'Accept-Encoding': 'gzip, deflate',
|
||||||
|
'Accept-Language': 'en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7',
|
||||||
|
'Cache-Control': 'max-age=0',
|
||||||
|
'DNT': '1',
|
||||||
|
'Referer': 'https://www.google.com/',
|
||||||
|
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 '
|
||||||
|
'(KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36',
|
||||||
|
'Upgrade-Insecure-Requests': '1',
|
||||||
|
'X-Forwarded-For': '127.0.0.1'
|
||||||
|
}
|
||||||
|
enable_random_ua = True # 使用随机UA(默认True,开启可以覆盖request_default_headers的UA)
|
||||||
|
|
||||||
|
|
||||||
# 搜索模块设置
|
# 搜索模块设置
|
||||||
enable_recursive_search = False # 递归搜索子域
|
enable_recursive_search = False # 递归搜索子域
|
||||||
search_recursive_times = 2 # 递归搜索层数
|
search_recursive_times = 2 # 递归搜索层数
|
||||||
|
|||||||
Reference in New Issue
Block a user