求助:python requests上传xlsx文件的实现问题

如图所示:


这是一个导入xlsx文件的接口抓包
requests请求要如何实现呢?
我的代码如下:

    def ofc_import_delivery(self):
        header = {"content-type": "multipart/form-data; boundary=----WebKitFormBoundary2IOQu898I9WugXEw"}
        self.header_common.update(header)
        add_import_delivery = "/ofc/import-delivery"
        file = {"file": open("delivery_614774351257952256.xlsx", "rb")}
        upload_data = {"Content-Type": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
                       "File name": "delivery_614774351257952256.xlsx",
                       "userMode": "1"}
        res = requests.post(url=self.host + add_import_delivery, headers=self.header_common,
                            files=file, data=upload_data, verify=False)
        self.json_decode(res)

接口请求报错,实在不知道该怎么拼装file了

求助啊 :sob:必要的话可以开向日葵远程帮忙看一下

关闭