| | |
| | | } |
| | | |
| | | def get_Token(): |
| | | url = "http://192.168.7.127:8083/sys/login" |
| | | url = "http://192.168.7.104:8081/sys/login" |
| | | headers = { |
| | | "content-type":"application/json; charset=UTF-8" |
| | | } |
| | | # 获取用户账号密码 |
| | | df = conftest.read_excel("TestData/userinfo.xlsx") |
| | | df = conftest.read_excel("TestData/userinfo_2.xlsx") |
| | | # 封装为字典列表 |
| | | UserList = conftest.get_list(df,["username","password"]) |
| | | # 遍历用户字典列表的索引和值 |
| | |
| | | username = aes_encrypt(user["username"], "abcdefgh12345678", "12345678abcdefgh") |
| | | password = aes_encrypt(user["password"], "abcdefgh12345678", "12345678abcdefgh") |
| | | # 构造请求体 |
| | | params = {"code": "1234","username": username, "password": password } |
| | | params = {"code": "","username": username, "password": password,} |
| | | try: |
| | | response = requests.post(url=url, headers=headers, json=params, verify=False) |
| | | if response.status_code == 200: |
| | | data = response.json() |
| | | token = data["token"] |
| | | token = data["refreshToken"] |
| | | print(user["username"]) |
| | | if token: |
| | | # Token写入Excel文件 |
| | | conftest.write_excel("TestData/userinfo.xlsx",index,"token",token) |