slack.py 文件源码

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

项目:irisett 作者: beebyte 项目源码 文件源码
def send_slack_notification(url: str, attachments: List[Dict]):
    data = {
        'attachments': attachments
    }
    try:
        async with aiohttp.ClientSession() as session:
            async with session.post(url, data=json.dumps(data), timeout=30) as resp:
                if resp.status != 200:
                    log.msg('Error sending slack notification: http status %s' % (str(resp.status)),
                            'NOTIFICATION')
    except aiohttp.ClientError as e:
        log.msg('Error sending slack notification: %s' % (str(e)), 'NOTIFICATIONS')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号