def post_message(msg, endpoint, channel, username='BBTornado', unfurl_links=False, icon=":robot_face:"):
"""
Post a message on slack.
This will "fire-and-forget", so returns nothing.
"""
client = AsyncHTTPClient()
body = dict(icon_emoji=icon,
text=msg,
username=username,
unfurl_links=unfurl_links,
channel=channel)
req = HTTPRequest(endpoint, method='POST', headers={ 'Content-Type': 'application/json' }, body=json.dumps(body))
IOLoop.current().spawn_callback(client.fetch, req, raise_error=False)
评论列表
文章目录