代码为:
import requests
from requests_toolbeltimport MultipartEncoder
url1= "https://xxx/xx?auth_code=1d3a1c383deb427ebb5a0a877cc328ee&pid=189&__tData__=1618280514779"
data= MultipartEncoder({
'action': 'preview',
'auth_code': '1d3a1c383deb427ebb5a0a877cc328ee',
'template': ('testfile.xlsx', open('/Users/mac/Downloads/testfile.xlsx', 'rb'), 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'),
})
headers= {
"Content-Type": data.content_type
}
r= requests.post(url1, data=data, headers=headers)
key= r.json()['key']
print(r.text)