Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
349 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 Reply

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...