#!-*-coding:utf-8-*-
import sys
import os
import time
from concurrent.futures import ThreadPoolExecutor
target = {}
target[0] = "http://www.baidu.com"
target[1] = "https://tenfei04.cfp.cn/creative/vcg/veer/1600water/veer-147317368.jpg"
proxy = "192.168.3.76:10087"
count = 0
def run(name):
global count, target, proxy
try:
url = target[name%2]
while True:
count += 1
shell = "curl -s --socks5-hostname " + proxy + " " + url
res = os.popen(shell).read().replace("\n", " ")
print(name, count, len(res))
except Exception as e:
print (e)
task = []
with ThreadPoolExecutor(max_workers=200) as pool:
for i in range(200):
print(i)
t = pool.submit(run, i)
task.append(t)
print("begin")
while True:
time.sleep(10)