使用requests.post方法请求Content-Type: multipart/form-data格式的接口,今天试了很多次都跟实际接口的请求不一致,传入的数据格式对不上,主要原因是在headers头中不用再传入Content-Type: multipart/form-data,具体见例子
1、传入的参数每个字段以元祖的格式保存
parm2 ={ "occur_time": (None,'2019-02'), "logistics_provider_id":( None,'483'), "logistics_way_basic_info_id":(None, ''), "batch_name": (None,'20190301'), "number_type":(None,'5'), "currency":(None,'49'), "actual_receive_date": (None,'2019-03-01 00:00:44'), "carriage_bill_period": (None,'1'), "settlement_days":(None, '30'), "bill_month_start":(None,'2018-11'), "bill_month_end":(None,'2018-11'), "bill_date":(None,'2018-11-11 (星期日)'), "bill_date":(None,'2018-11-11 (星期日)'), }
2、传入的files字段以字典的格式保存
file_o