本文整理汇总了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