Slack Bot rtm connect使用python slackclient在代理后面失败

时间:2019-02-19 12:10:11

标签: python slack slack-api

使用代理SlackClient.rtm_connect()运行Slack bot失败并出现以下错误时,同时api_calls api.testauth.test似乎运行良好,您知道如何解决此问题吗?我是否缺少其他配置?

WARNING:slackclient.client:Failed RTM connect
Connection failed. Exception traceback printed above.
Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\slackclient\client.py", line 140, in rtm_connect
    self.server.rtm_connect(use_rtm_start=with_team_state, **kwargs)
  File "C:\Python27\lib\site-packages\slackclient\server.py", line 159, in rtm_connect
    self.connect_slack_websocket(self.ws_url)
  File "C:\Python27\lib\site-packages\slackclient\server.py", line 200, in connect_slack_websocket
    raise SlackConnectionError(message=str(e))
SlackConnectionError: [Errno 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond

下面是代码段,

from slackclient import SlackClient

client_proxies = {"https": "https://127.0.0.1:8080"}

slack_client = SlackClient(token=BOT_TOKEN, proxies=client_proxies)

print slack_client.api_call("api.test")
print slack_client.api_call("auth.test")

slack_client.rtm_connect()

api_call api.test返回下面

{u'token': u'TOKEN'}, u'ok': True}

0 个答案:

没有答案