Slack API - rtm_connect 错误 [英] Slack API - rtm_connect error
问题描述
在尝试使用 Slack API(实时消息传递)时,我收到了似乎是认证错误的信息.
When attempting to use the Slack API (Real Time Messaging) I get what seems to be a certification error.
任何想法为什么会发生这种情况?很想得到一些反馈,为我指明正确的方向.我使用的是 python 2.7,代码托管在 pythonanywhere 的付费帐户中.
Any ideas why this is happening? Would love to get some feedback to point me in the right direction. I am using python 2.7 and the code is hosted in a paid account at pythonanywhere.
import os
from slackclient import SlackClient
verif_token = os.environ.get("MYTOKEN")
slack_client = SlackClient(verif_token)
slack_client.rtm_connect(with_team_state=False)
Traceback (most recent call last):
File "/home/xyz/.local/lib/python2.7/site-packages/slackclient/client.py", line 52, in rtm_connect
self.server.rtm_connect(use_rtm_start=with_team_state, **kwargs)
File "/home/xyz/.local/lib/python2.7/site-packages/slackclient/server.py", line 147, in rtm_connect
self.connect_slack_websocket(self.ws_url)
File "/home/xyz/.local/lib/python2.7/site-packages/slackclient/server.py", line 186, in connect_slack_websocket
raise SlackConnectionError(message=str(e))
SlackConnectionError: _ssl.c:335: No root certificates specified for verification of other-side certificates.
推荐答案
如果看起来这是 slack 使用的 websocket 库的一个已知问题:https://github.com/slackapi/python-slackclient/issues/334.
If looks like this was a known issue with the websocket library that slack uses: https://github.com/slackapi/python-slackclient/issues/334.
将 websocket-client 库降级到 0.47.0 解决了这个问题.
Downgrading the websocket-client library to 0.47.0 solved the problem.
这篇关于Slack API - rtm_connect 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!