本文整理匯總了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
示例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