在做接口自动化中,很多都会涉及到上传图片或视频
需要注意头文件可变(Content-Type)去掉可变的
需要加上file,我的如下:
file = {"file": open(r'E: est.mp4', 'rb'), "Content-Type": "application/octet-stream",
"Content-Disposition": "form-data", "filename": "test.mp4"}
response = requests.post(url, headers=headers, params=params, files=file, verify=False)