notification.py 文件源码

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

项目:Monocle 作者: Noctem 项目源码 文件源码
def hook_post(self, w, session, payload, headers={'content-type': 'application/json'}):
        try:
            async with session.post(w, json=payload, timeout=4, headers=headers) as resp:
                return True
        except ClientResponseError as e:
            self.log.error('Error {} from webook {}: {}', e.code, w, e.message)
        except (TimeoutError, ServerTimeoutError):
            self.log.error('Response timeout from webhook: {}', w)
        except ClientError as e:
            self.log.error('{} on webhook: {}', e.__class__.__name__, w)
        except CancelledError:
            raise
        except Exception:
            self.log.exception('Error from webhook: {}', w)
        return False
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号