From c6eae66374a01fffe7ee158549555ef160c724b4 Mon Sep 17 00:00:00 2001 From: oyty Date: Mon, 26 Mar 2018 14:40:44 +0800 Subject: [PATCH 1/2] Create index.py --- index.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 index.py diff --git a/index.py b/index.py new file mode 100644 index 0000000..0f9a87d --- /dev/null +++ b/index.py @@ -0,0 +1,16 @@ +from github_webhook import Webhook +from flask import Flask + +app = Flask(__name__) # Standard Flask app +webhook = Webhook(app) # Defines '/postreceive' endpoint + +@app.route("/") # Standard Flask endpoint +def hello_world(): + return "Hello, World!" + +@webhook.hook() # Defines a handler for the 'push' event +def on_push(data): + print("Got push with: {0}".format(data)) + +if __name__ == "__main__": + app.run(host="0.0.0.0", port=80) From e953000ee0d814a21e4f0ea041f87430fb73e644 Mon Sep 17 00:00:00 2001 From: oyty Date: Mon, 26 Mar 2018 14:44:33 +0800 Subject: [PATCH 2/2] Update index.py --- index.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/index.py b/index.py index 0f9a87d..c637477 100644 --- a/index.py +++ b/index.py @@ -1,7 +1,9 @@ from github_webhook import Webhook +from flask_script import Manager from flask import Flask app = Flask(__name__) # Standard Flask app +manager = Manager() webhook = Webhook(app) # Defines '/postreceive' endpoint @app.route("/") # Standard Flask endpoint @@ -13,4 +15,4 @@ def on_push(data): print("Got push with: {0}".format(data)) if __name__ == "__main__": - app.run(host="0.0.0.0", port=80) + app.run(host="0.0.0.0")