python 인터페이스 테스트 스 크 립 트 + 스 레 드 + 매개 변수 화

#coding=utf-8
import httplib 
from time import ctime  
import threading 
import csv 


#             
peopleinfo="C:\\Users\\ewang\\Desktop\\Infor.csv"


#url="C:\\Users\\ewang\\Desktop\\UrlInfo.csv"


#               
userInfo=file(peopleinfo,"rb")


#UrlFile=file(url,"w+")
#Url=open(url,"w+") 


#      
def Clean():

#        
reader=csv.reader(userInfo)
#          
for line in reader:
  #   url
requrl = "http://   IP/service/clean?uid=0&client="+line[2]+"&deviceId="+line[0]
  #        
conn = httplib.HTTPConnection("   IP")
  #       
conn.request(method="GET",url=requrl)
       #         
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()
#      
userInfo.close()

좋은 웹페이지 즐겨찾기