當前位置: 首頁>>代碼示例>>Python>>正文


Python PackagesLogic.get_for_webhook_rebuild方法代碼示例

本文整理匯總了Python中coprs.logic.packages_logic.PackagesLogic.get_for_webhook_rebuild方法的典型用法代碼示例。如果您正苦於以下問題:Python PackagesLogic.get_for_webhook_rebuild方法的具體用法?Python PackagesLogic.get_for_webhook_rebuild怎麽用?Python PackagesLogic.get_for_webhook_rebuild使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在coprs.logic.packages_logic.PackagesLogic的用法示例。


在下文中一共展示了PackagesLogic.get_for_webhook_rebuild方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: webhooks_hello

# 需要導入模塊: from coprs.logic.packages_logic import PackagesLogic [as 別名]
# 或者: from coprs.logic.packages_logic.PackagesLogic import get_for_webhook_rebuild [as 別名]
def webhooks_hello(copr_id, uuid):
    # For the documentation of the data we receive see:
    # https://developer.github.com/v3/activity/events/types/#pushevent
    try:
        copr = ComplexLogic.get_copr_by_id_safe(copr_id)
    except ObjectNotFound:
        return page_not_found("Project does not exist")

    if copr.webhook_secret != uuid:
        return access_restricted("This webhook is not valid")

    try:
        request_json = flask.request.json
        clone_url = request_json["repository"]["clone_url"]
    except KeyError:
        return "Bad Request", 400
    if "commits" in request_json:
        commits = request_json["commits"]
    else:
        commits = []

    packages = PackagesLogic.get_for_webhook_rebuild(copr_id, uuid, clone_url, commits)

    for package in packages:
        BuildsLogic.rebuild_package(package)

    db.session.commit()

    return "OK", 200
開發者ID:0-T-0,項目名稱:copr,代碼行數:31,代碼來源:webhooks_general.py

示例2: webhooks_hello

# 需要導入模塊: from coprs.logic.packages_logic import PackagesLogic [as 別名]
# 或者: from coprs.logic.packages_logic.PackagesLogic import get_for_webhook_rebuild [as 別名]
def webhooks_hello(copr_id, uuid):
    try:
        copr = ComplexLogic.get_copr_by_id_safe(copr_id)
    except ObjectNotFound:
        return page_not_found("Project does not exist")

    if copr.webhook_secret != uuid:
        return access_restricted("This webhook is not valid")

    try:
        request_json = flask.request.json
        clone_url = request_json["repository"]["clone_url"]
    except KeyError:
        return "Bad Request", 400

    packages = PackagesLogic.get_for_webhook_rebuild(copr_id, uuid, clone_url)

    for package in packages:
        BuildsLogic.rebuild_package(package)

    db.session.commit()

    return "OK", 200
開發者ID:danvratil,項目名稱:copr,代碼行數:25,代碼來源:webhooks_general.py


注:本文中的coprs.logic.packages_logic.PackagesLogic.get_for_webhook_rebuild方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。