1.由于公司做接口测试,遇到了上传文件,一直搞了好久,原来是加了头部的原因
def test_79(self):
'''导入配置文件'''
request = e['mysqlshujuku']
url = request['url12']
data = {"name": "2132131", "comment": "2132131", "version": "mysql5.6", "local_id": "beijing",
"project_id": "0"}
files = {'template_file': open(r"C:\Users\00\Desktop\test.txt", 'rb')}
rep = requests.request("POST", url, data=data, cookies=cookies, files=files, verify=False).json()
print(rep)