Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
412 views
in Technique[技术] by (71.8m points)

python - 如何使用“ notifiers”模块从python发送带有颜色编码的附件到Slack(how to send color coded attachment to slack, from python with the “notifiers” module)

I would like to color code my slack message using the 'good' (green) color code.

(我想使用“好”(绿色)颜色代码为我的闲暇消息添加颜色。)

I am using the python notifiers module combined with "incoming webhooks".

(我正在使用结合“传入的webhooks”的python notifiers模块。)

I tried the following with no luck:

(我没有运气就尝试了以下方法:)

try1:

(尝试1:)

from notifiers import get_notifier

slack = get_notifier('slack')
slack._schema['properties']['attachments']['items']['properties']['color'] = 'good'
return slack.notify(message=msg,
            webhook_url=slack_bot_url)

try2:

(try2:)

from notifiers import get_notifier

slack = get_notifier('slack')
return slack.notify(message=msg,
            webhook_url=slack_bot_url, attachments=[{dict(color='good')}])

Any idea how can I send a color coded message to slack using the notifiers module?

(知道如何使用notifiers模块将颜色编码的消息发送到松弛状态吗?)

Resources:

(资源:)

  ask by Yuval Atzmon translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...