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