【发布时间】:2020-11-04 12:07:14
【问题描述】:
这是我将 pdf 文件发送到我的松弛工作区的代码。但它会产生错误。
client = WebClient(token=os.environ[SLACK_BOT_TOKEN])
try:
filepath = "./output.pdf"
response = client.files_upload(channels='#mychannelid_here', file=filepath)
assert response["file"] # the uploaded file
except SlackApiError as e:
# You will get a SlackApiError if "ok" is False
assert e.response["ok"] is False
assert e.response["error"] # str like 'invalid_auth', 'channel_not_found'
print(f"Got an error: {e.response['error']}")
错误是:
从无提升 KeyError(key) KeyError:SLACK_BOT_TOKEN_HERE
提前感谢您的帮助!
【问题讨论】: