1
Fork 0

Add custom ping event

This commit is contained in:
Jake Howard 2018-10-25 21:06:55 +01:00
parent 2f05e70945
commit 7404a4322d
Signed by: jake
GPG key ID: 57AFB45680EDD477

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import logging import logging
from flask import Flask from flask import Flask, abort, jsonify
from github_webhook import Webhook from github_webhook import Webhook
from . import config from . import config
@ -11,5 +11,11 @@ logging.basicConfig(level=logging.INFO)
app = Flask(__name__) app = Flask(__name__)
webhook = Webhook(app, secret=config.GITHUB_WEBHOOK_SECRET) webhook = Webhook(app, secret=config.GITHUB_WEBHOOK_SECRET)
@webhook.hook(event_type="ping")
def ping(data):
return abort(jsonify({"ping": "pong"}))
if __name__ == "__main__": if __name__ == "__main__":
app.run(host="0.0.0.0") app.run(host="0.0.0.0")