我正在尝试用python运行POST请求。当我在Postman中测试时,它运行良好并导入文件。当我在Python中运行它时,我会出错。这将我的计算机上存储的电子表格发布到Quip中。我得到的错误是缺少参数“file”。我试过移动一些东西,但不确定我错过了什么。以下是我的工作内容:
import requests
url = "https://platform.quip.com/1/threads/import-file"
payload = {'type': 'spreadsheet'}
files = [
('file', open('/Users/admin/Documents/excel/logs/Output/test.xlsx','rb'))
]
headers = {
'Content-Type': 'application/x-www-form-urlencoded',
'Authorization': 'Bearer **************************='
}
response = requests.request("POST", url, headers=headers, data = payload, files = files)
print(response.text.encode('utf8'))
目前没有回答
相关问题 更多 >
编程相关推荐