我需要一个帮助来创建一个python看门狗系统来监控GitHub存储库。想法是:每次在repo (master)上推送新的东西时,我想用新的提交/推送更新我在服务器上的repo。
你知道怎么做到这一点吗?我为我的英语感到抱歉。在此之前,非常感谢您。
发布于 2021-08-06 19:31:08
OK!我已经为这个找到了两个解决方案
1.如果您拥有想要查看的存储库,则为
2.不是你的回购
接受你想要的url,即https://github.com/fire17/gd-xo/,
https://github.com/fire17/gd-xo/commits/master.atom
响应导入请求;
= requests.get("http://api.open-notify.org/astros.json").text
response.split("")1.split("") '2021-08-06T19:01:53Z'
我很高兴终于实现了这个功能希望这对我有帮助!
发布于 2021-03-25 05:56:00
一种解决方案是使用github 'push' webhook。这意味着,您可以设置一个web服务,其中github可以告诉您何时发生了推送,而不是不断轮询repo以获取更改。
使用flask的一个非常基本的示例可能如下所示
from flask import Flask, request, abort
import hmac
app = Flask(__name__)
@app.route("/myhook", methods=['POST'])
def github_push_webhook():
signature = request.headers.get("X-Hub-Signature")
digest = hmac.new(GITHUB_SECRET.encode(), request.data, hashlib.sha1).hexdigest()
if not hmac.compare_digest(signature, "sha1=" + digest):
abort(400, "Bad Request")
webhook_data = request.get_json()
changed_repository = webhook_data.get('repository')
# clone the repoisitory...https://stackoverflow.com/questions/66789861
复制相似问题