Python - 本地 csv 文件未通过 SlackAPI 正确发送到松弛通道

Python - Local csv file isn't being properly sent to slack channel via SlackAPI

我正在尝试将本地 csv 文件发送到我通过 SlackAPI 使用 Python 脚本创建的松弛通道。我的脚本执行了,但文件作为私人文件发送,只有我可以看到。我希望它在整个频道中都可见并且看起来像这样:

我看到了其他与此类似的问题,但我似乎仍然无法让这段代码完成我所描述的事情。我是频道的所有者,我使用的是遗留令牌。下面是我的代码:

from slackclient import SlackClient

sc = SlackClient('Token')

sc.api_call(
"files.upload",
filename='sample.csv',
channel='#secdevtest1',
username='AMI Rehydrator',
file=open('sample.csv', 'r').read()
)

使用channels代替channel

此外,来自here

By default all newly-uploaded files are private and only visible to the owner. They become public once they are shared into a public channel (which can happen at upload time via the channels argument).