__init__.py 文件源码

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

项目:Jackalope 作者: brysontyrrell 项目源码 文件源码
def jamf_webhook(jamf_uuid):
    """The receiver endpoint where ``jamf_uuid`` is the auto-generated UUID for
     and installed Slack channel.

     Inbound webhooks must be in JSON format or a 400 error will be returned.

     If a supported webhook event has been received it will be formatted into
     a Slack message via
     :func:`jackalope.routes.jamfpro.webhooks.webhook_notification` and sent via
     :func:`jackalope.slack.send_notification`.

     :param str jamf_uuid: The generated UUID for the installed Slack channel.

     :raises: SlackChannelLookupError
     :raises: JSONNotProvided

     :returns: HTTP 204 success response.
     """
    try:
        channel = SlackChannel.query.filter_by(jamf_uuid=jamf_uuid).one()
    except (NoResultFound, MultipleResultsFound) as err:
        raise SlackChannelLookupError(err)

    if not flask.request.json:
        raise JSONNotProvided

    message = webhook_notification(flask.request.json)

    if message:
        send_notification(channel.slack_webhook_url, message)

    return '', 204
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号