【发布时间】:2017-07-27 07:12:47
【问题描述】:
我正在尝试使用https://api.slack.com/methods/files.upload 提供的 Web-API 将文件 sn-p 上传到 slack 中的频道
payload_channel_caller = {'token': 'xoxpxxxxb1d8529c', 'channel':'C1PJ17FFT', 'file': "/home/nsingh/slack_shift/user_list" ,'title':'Shifters'}
print "This is a test"
requests.post('https://slack.com/api/files.upload', data=payload_channel_caller)
但上面的代码无法上传文件,实际上它运行正常,没有错误。
不知道这里出了什么问题。
谁能帮帮我
【问题讨论】:
-
我几乎可以肯定您必须实际发送文件对象而不是文件路径,例如
'file': open("/path/to/file", "rb") -
有什么反应? (
r.content)
标签: python python-2.7 python-requests slack slack-api