# -*- coding:utf-8 -*-
#coding=utf-8
import requests
import threading
url1 = 'http://bbs.baidu.com/forum-43-1.html'
url2 = 'http://bbs.baidu.com/forum-25-1.html'
url3 = 'http://bbs.baidu.com/forum-4-1.html'
url4 = 'http://bbs.baidu.com/forum-9-1.html'
url5 = 'http://bbs.baidu.com/forum-5-1.html'
url6 = 'http://bbs.baidu.com/forum-654-1.html'
url7 = 'http://bbs.baidu.com/forum-655-1.html'
url8 = 'http://bbs.baidu.com/forum-656-1.html'
url9 = 'http://bbs.baidu.com/forum-56-1.html'
url10 = 'http://bbs.baidu.com/forum-64-1.html'
url11 = 'http://bbs.baidu.com/forum-66-1.html'
url12 = 'http://bbs.baidu.com/forum-74-1.html'
url13 = 'http://bbs.baidu.com/forum-75-1.html'
url14 = 'http://bbs.baidu.com/forum-76-1.html'
url15 = 'http://bbs.baidu.com/forum-58-1.html'
url999 = 'http://bbs.baidu.com/forum-65-1.html'
headers = {'User-Agent':'Mozilla/5.0 (compatible; Baiduspider/2.0; +http://www.baidu.com/search/spider.html)'}
def baidu1():
global number1
number1 = 0
while True:
number1 = number1 + 1
requests.get(url1,headers = headers)
def baidu2():
global number2
number2 = 0
while True:
number2 = number2 + 1
requests.get(url2,headers = headers)
def baidu3():
global number3
number3 = 0
while True:
number3 = number3 + 1
requests.get(url3,headers = headers)
def baidu4():
global number4
number4 = 0
while True:
number4 = number4 + 1
requests.get(url4,headers = headers)
def baidu5():
global number5
number5 = 0
while True:
number5 = number5 + 1
requests.get(url5,headers = headers)
def baidu6():
global number6
number6 = 0
while True:
number6 = number6 + 1
requests.get(url6,headers = headers)
def baidu7():
global number7
number7 = 0
while True:
number7 = number7 + 1
requests.get(url7,headers = headers)
def baidu8():
global number8
number8 = 0
while True:
number8 = number8 + 1
requests.get(url8,headers = headers)
def baidu9():
global number9
number9 = 0
while True:
number9 = number9 + 1
requests.get(url9,headers = headers)
def baidu10():
global number10
number10 = 0
while True:
number10 = number10 + 1
requests.get(url10,headers = headers)
def baidu11
():
global number11
number11 = 0
while True:
number11 = number11 + 1
requests.get(url11,headers = headers)
def baidu12():
global number12
number12 = 0
while True:
number12 = number12 + 1
requests.get(url12,headers = headers)
def baidu13():
global number13
number13 = 0
while True:
number13 = number13 + 1
requests.get(url13,headers = headers)
def baidu14():
global number14
number14 = 0
while True:
number14 = number14 + 1
requests.get(url14,headers = headers)
def baidu15():
global number15
number15 = 0
while True:
number15 = number15 + 1
requests.get(url15,headers = headers)
def baidu999():
global number999
number999 = 0
while True:
number999 = number999 + 1
r = requests.get(url999,headers = headers)
tall = number999+number1 + number2 + number3 + number4 + number5+number6+number7+number8+number9+number10+number11+number12+number13+number14+number15
print('---第' + str(tall)+'次'','+ '状态码:'+ str(r.status_code))
t1 = threading.Thread(target=baidu1)
t2 = threading.Thread(target=baidu2)
t3 = threading.Thread(target=baidu3)
t4 = threading.Thread(target=baidu4)
t5 = threading.Thread(target=baidu5)
t6 = threading.Thread(target=baidu6)
t7 = threading.Thread(target=baidu7)
t8 = threading.Thread(target=baidu8)
t9 = threading.Thread(target=baidu9)
t10 = threading.Thread(target=baidu10)
t11 = threading.Thread(target=baidu11)
t12 = threading.Thread(target=baidu12)
t13 = threading.Thread(target=baidu13)
t14 = threading.Thread(target=baidu14)
t15 = threading.Thread(target=baidu15)
t999
= threading.Thread(target=baidu999)
t1.start()
t2.start()
t3.start()
t4.start()
t5.start()
t6.start()
t7.start()
t8.start()
t9.start()
t10.start()
t11.start()
t12.start()
t13.start()
t14.start()
t15.start()
t999.start()