从数据库导出一批账号用来登入获得用户的登入cookie,以便其他地方使用
账号(这里提取了9300个账号)
2:通过登入接口,获取用户登入后的cookie值
#! -*-coding:utf-8 -*-
import requests
for name in open('E:\\jmeter_work\\web_user.txt','r'):
login_name=name.strip('\n')
url="http://****:*/sysUser/login"
headers = {'Content-Type': 'application/x-www-form-urlencoded',"channel":"manager"}
par={"loginName":login_name,"password":"123456","code":"8888"}
r=requests.post(url,data=par,headers=headers)
s=requests.session()
print(r.cookies)
cookies=r.cookies
strlist=str(cookies).split(' ')
print type(strlist)
print strlist[1]
cookievalue=strlist[1]
f = open('E:\\jmeter_work\\web_usercookie.txt','a')
f.write(cookievalue)
f.write('\n')
f.close()