微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

如何解决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 举报,一经查实,本站将立刻删除。