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')
评论列表
文章目录