SlackConnectionError: [SSL: CERTIFICATE_VERIFY_FAILED] 证书验证失败 (_ssl.c:579) 使用 files.upload of slack API

问题描述

我一直在尝试将 csv 报告文件发送到团队 slack 频道。但我失败了并给出了 SSLConnection 错误。我已经阅读了此处发布的其他类似问题,但没有任何工作。以下是我的代码。请让我知道我该如何解决这个问题。

import os
# Import WebClient from Python SDK (github.com/slackapi/python-slack-sdk)
from slack_sdk import WebClient
from slack_sdk.errors import SlackApiError

# WebClient insantiates a client that can call API methods
# When using Bolt,you can use either `app.client` or the `client` passed to listeners.
client = WebClient(token='slackhook_token')
# The name of the file you're going to upload
file_name = os.path.abspath('`enter code here`cert_auth_exp_pok.csv')
# ID of channel that you want to upload file to
channel_id = "B01L4PA"

try:
    # Call the files.upload method using the WebClient
    # Uploading files requires the `files:write` scope
    result = client.files_upload(
        channels=channel_id,initial_comment="Here's my file :smile:",file=file_name,)
    # print the result
    print(result)

except SlackApiError as e:
    print("Error uploading file: {}".format(e))

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)