標籤:sts daemon end time utf-8 __name__ min username pre
一、同一使用者並發上傳不同檔案內容
#coding=utf-8import requestsimport threadingfrom time import ctime,time# D:\\code\\budget_test\\api\\1.xlsx‘filelist=[‘C:\\Users\\53843\\Desktop\\1.xlsx‘, ‘C:\\Users\\53843\\Desktop\\2.xlsx‘ ]def t1(filedir): data1 = { ‘username‘:"admin", ‘password‘:"111", ‘loginbutton‘:"登 錄" } s = requests.session() s.post(url=‘http://172.16.1.64:8080/business-analysis-1.0/a/login‘,data=data1) print ("I was at the %s " %ctime()) files={‘file‘: open(filedir, ‘rb‘)} print ("I was at the %s start!" %ctime()) r=s.post(url=‘http://172.16.1.64:8080/business-analysis-1.0/a/budget/budgetHead/excelTodata‘,files=files) print(r.text)threads=[]nub=2for i in range(2): threads.append(threading.Thread(target = t1(filelist[i])))if __name__==‘__main__‘: for t in threads: t.setDaemon(True) t.start() t.join() print("all over %s"%ctime())
python介面並發