问题
When attempting to use the Slack API (Real Time Messaging) I get what seems to be a certification error.
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.
回答1:
If looks like this was a known issue with the websocket library that slack uses: https://github.com/slackapi/python-slackclient/issues/334.
Downgrading the websocket-client library to 0.47.0 solved the problem.
来源:https://stackoverflow.com/questions/51551333/slack-api-rtm-connect-error