流程调整
This commit is contained in:
parent
d07b07cd45
commit
35d34bd1d6
@ -1,3 +1,4 @@
|
|||||||
{
|
{
|
||||||
"executable_path": "C:/Program Files/Google/Chrome/Application/chromedriver.exe"
|
"executable_path": "C:/Program Files/Google/Chrome/Application/chromedriver.exe",
|
||||||
|
"workers": 5
|
||||||
}
|
}
|
12
main.py
12
main.py
@ -3,6 +3,13 @@ import sys
|
|||||||
import proxy
|
import proxy
|
||||||
import w_token
|
import w_token
|
||||||
from concurrent.futures import ThreadPoolExecutor, as_completed
|
from concurrent.futures import ThreadPoolExecutor, as_completed
|
||||||
|
import json
|
||||||
|
|
||||||
|
f = open('config.json', 'r')
|
||||||
|
content = f.read()
|
||||||
|
f.close()
|
||||||
|
data = json.loads(content)
|
||||||
|
workers = data["workers"]
|
||||||
|
|
||||||
|
|
||||||
def task(aid, username, password):
|
def task(aid, username, password):
|
||||||
@ -36,7 +43,8 @@ def main():
|
|||||||
if t == "N" or t == "n":
|
if t == "N" or t == "n":
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
with ThreadPoolExecutor(max_workers=5) as executor:
|
count = 0
|
||||||
|
with ThreadPoolExecutor(max_workers=workers) as executor:
|
||||||
# 提交多个任务给线程池
|
# 提交多个任务给线程池
|
||||||
futures = [executor.submit(task, row[0], row[1], row[4]) for row in u]
|
futures = [executor.submit(task, row[0], row[1], row[4]) for row in u]
|
||||||
|
|
||||||
@ -47,7 +55,9 @@ def main():
|
|||||||
print("applyId:【%s】,username:【%s】获取失败" % (result[0], result[1]))
|
print("applyId:【%s】,username:【%s】获取失败" % (result[0], result[1]))
|
||||||
continue
|
continue
|
||||||
dao.update_token(result[0], result[2])
|
dao.update_token(result[0], result[2])
|
||||||
|
count = count + 1
|
||||||
print("applyId:【%s】,username:【%s】获取成功!!!" % (result[0], result[1]))
|
print("applyId:【%s】,username:【%s】获取成功!!!" % (result[0], result[1]))
|
||||||
|
print("一共【%d】人,成功【%d】人" % (len(u), count))
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
Loading…
Reference in New Issue
Block a user