python實現多執行緒post方法進行壓

#coding=utf-8  import httplib,urllib  from time import ctime  import threading  import csv    postJson={           }  #定義需要進行發送的數據  params = urllib.urlencode(postJson);    #定義一些文件頭  headers = {"Content-Type":"application/x-www-form-urlencoded",             "Connection":"Keep-Alive"  		   }    #創建請求函數  def Clean():    	   #介面的url  		requrl =""  	   #連接伺服器  		conn = httplib.HTTPConnection("")  	   #發送請求  		conn.request(method="POST",url=requrl,body=params,headers=headers)         #獲取請求響應  		response=conn.getresponse()  	   #列印請求狀態  		print response.status        #創建數組存放執行緒  threads=[]  #創建100個執行緒  for i in range(100):       #針對函數創建執行緒       t=threading.Thread(target=Clean,args=())       #把創建的執行緒加入執行緒組       threads.append(t)    print 'start:', ctime()  if __name__ == '__main__':     #啟動執行緒     for i in threads:          i.start()     #keep thread     for i in threads:          i.join()    print 'end:', ctime()  #Url.close()