Add custom ping event
This commit is contained in:
parent
2f05e70945
commit
7404a4322d
1 changed files with 7 additions and 1 deletions
|
@ -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")
|
||||||
|
|
Reference in a new issue