slack.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:bbtornado 作者: bakkenbaeck 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号