情形一:
大文件上传 例如上图这种形式的, 使用如下代码进行复现
with open('ttt.mp4', 'rb') as f:
response = requests.post('https://upgz.video.xxx.com/2/fileplatform/upload.json', params=params,
headers=headers, proxies=proxies, verify=False, data=f)
情形一:
抓包例如这种形式的,使用如下代码进行视频上传:
m = MultipartEncoder( fields={ 'shardIndex': str(i+1), # 'md5': 'ff46bc949286febeaefa84aaf1e1b86f', 'shardTotal': str(chunk_cnt), 'name': 'ttt.mp4', 'suffix': 'mp4', # 'lastModifiedDate': 'Fri Jul 22 2022 16:04:37 GMT+0800', 'use': "视频上传", "key": self.file_key, "coverName": "", "coverBase64": "", 'size': str(len(res)), "shardSize": str(chunk_size), # 'chunks': '1', # 'chunks': str(chunk_cnt), # 'chunk': '0', # 'chunk': 1, # 'upload_key': str(key), 'shard': ('blob', res[i:i + chunk_size], 'application/octet-stream')} ) cnt += 1 t_headers['Content-Type'] = m.content_type
response = requests.post(url, headers=t_headers, params=params, data=m, verify=False) print("上传视频") print(response.text)