在做接口自動化中,很多都會涉及到上傳圖片或視頻
需要注意頭文件可變(Content-Type)去掉可變的
需要加上file,我的如下:
file = {"file": open(r'E:\test.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)