通过 `slacker` 和 Slack API 将“0”发布到 Slack 频道
Posting "0" to Slack channel via `slacker` and Slack API
我正在尝试通过 slacker
包(版本 0.8.6)自动将一些号码 post 发送到我的 Slack 频道。有时需要打印的数字是 0
,但我发现 posting 0
或 "0"
给我一个错误...
from slacker import Slacker
API_TOKEN = XXXXXXXXXX # I load in my api token from an environment variable
slack = Slacker(API_TOKEN)
channel = '#test-channel'
message = "0"
slack.chat.post_message(channel, message, parse='full')
我收到此错误:slacker.Error: no_text
这是我的代码 slacker
还是 Slack API 本身的错误?
完整堆栈跟踪:
Traceback (most recent call last):
File "field-utils/fieldutils/slack.py", line 56, in <module>
slack.chat.post_message(channel, message, parse='full')
File "/Users/pedro/tools/slack-bot/venv/lib/python2.7/site-packages/slacker/__init__.py", line 257, in post_message
'icon_emoji': icon_emoji
File "/Users/pedro/tools/slack-bot/venv/lib/python2.7/site-packages/slacker/__init__.py", line 69, in post
return self._request(requests.post, api, **kwargs)
File "/Users/pedro/tools/slack-bot/venv/lib/python2.7/site-packages/slacker/__init__.py", line 61, in _request
raise Error(response.error)
slacker.Error: no_text
我重现了你的问题。我正在查看带有该消息的 Slacker and it seems like the Slack API is returning the error。
尝试:message = '0\n'
(这是一个愚蠢的 hack!但没有其他效果)
Slack 桌面应用程序似乎将其呈现为您已发送 0
我正在尝试通过 slacker
包(版本 0.8.6)自动将一些号码 post 发送到我的 Slack 频道。有时需要打印的数字是 0
,但我发现 posting 0
或 "0"
给我一个错误...
from slacker import Slacker
API_TOKEN = XXXXXXXXXX # I load in my api token from an environment variable
slack = Slacker(API_TOKEN)
channel = '#test-channel'
message = "0"
slack.chat.post_message(channel, message, parse='full')
我收到此错误:slacker.Error: no_text
这是我的代码 slacker
还是 Slack API 本身的错误?
完整堆栈跟踪:
Traceback (most recent call last):
File "field-utils/fieldutils/slack.py", line 56, in <module>
slack.chat.post_message(channel, message, parse='full')
File "/Users/pedro/tools/slack-bot/venv/lib/python2.7/site-packages/slacker/__init__.py", line 257, in post_message
'icon_emoji': icon_emoji
File "/Users/pedro/tools/slack-bot/venv/lib/python2.7/site-packages/slacker/__init__.py", line 69, in post
return self._request(requests.post, api, **kwargs)
File "/Users/pedro/tools/slack-bot/venv/lib/python2.7/site-packages/slacker/__init__.py", line 61, in _request
raise Error(response.error)
slacker.Error: no_text
我重现了你的问题。我正在查看带有该消息的 Slacker and it seems like the Slack API is returning the error。
尝试:message = '0\n'
(这是一个愚蠢的 hack!但没有其他效果)
Slack 桌面应用程序似乎将其呈现为您已发送 0