You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by da...@apache.org on 2024/08/26 14:04:40 UTC
(kafka-merge-queue-sandbox) branch asfquart created (now 515a62e)
This is an automated email from the ASF dual-hosted git repository.
davidarthur pushed a change to branch asfquart
in repository https://gitbox.apache.org/repos/asf/kafka-merge-queue-sandbox.git
at 515a62e switch to asfquart
This branch includes the following new commits:
new 515a62e switch to asfquart
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(kafka-merge-queue-sandbox) 01/01: switch to asfquart
Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
davidarthur pushed a commit to branch asfquart
in repository https://gitbox.apache.org/repos/asf/kafka-merge-queue-sandbox.git
commit 515a62ee8aff75c69442fa129177eb2e019d0519
Author: David Arthur <mu...@gmail.com>
AuthorDate: Mon Aug 26 09:56:09 2024 -0400
switch to asfquart
---
README.md | 5 ++++-
webhook-receive.py | 16 +++++++++-------
2 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/README.md b/README.md
index 22a69bf..ffe41b0 100644
--- a/README.md
+++ b/README.md
@@ -13,9 +13,12 @@ We need a Python virtualenv for running a local server.
```
python3 -m venv venv
source venv/bin/activate
-pip install Flask
```
+Download the quart framework https://github.com/apache/infrastructure-asfquart/ and install it
+into the virtualenv we just made.
+
+
Now, we can start the SMEE client to start receiving events from GitHub.
```
smee -u https://smee.io/wfaiAis5XU4SHXrC -t http://localhost:3000/webhook
diff --git a/webhook-receive.py b/webhook-receive.py
index f251ef3..b30a610 100644
--- a/webhook-receive.py
+++ b/webhook-receive.py
@@ -1,8 +1,10 @@
-from flask import Flask, request, jsonify
-from yaml import load, dump
-from yaml import Loader, Dumper
+import asfquart
-app = Flask(__name__)
+from quart import request, jsonify
+from yaml import load
+from yaml import Loader
+
+app = asfquart.construct("merge-queue-webhook")
with open("config.yml") as fp:
config = load(fp, Loader=Loader)
@@ -11,8 +13,8 @@ gh_user_map = config.get("gh-user-map", {})
@app.route('/webhook', methods=['POST'])
-def webhook_receiver():
- payload = request.json
+async def webhook_receiver():
+ payload = await request.get_json()
event = request.headers.get("X-Github-Event")
action = payload.get("action")
@@ -48,4 +50,4 @@ def webhook_receiver():
if __name__ == '__main__':
- app.run(debug=True, host='localhost', port=3000)
+ asfquart.APP.run(port=3000)