mirror of
https://github.com/FAUSheppy/simple-webhook-handler
synced 2025-12-08 21:18:33 +01:00
Initial
This commit is contained in:
9
.gitignore
vendored
Normal file
9
.gitignore
vendored
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
*.swp
|
||||||
|
*.txt
|
||||||
|
*.out
|
||||||
|
*.log
|
||||||
|
*.pyc
|
||||||
|
data/
|
||||||
|
build/
|
||||||
|
db/
|
||||||
|
__pychache__/
|
||||||
28
webhook-listener.py
Executable file
28
webhook-listener.py
Executable file
@@ -0,0 +1,28 @@
|
|||||||
|
#!/usr/bin/python3
|
||||||
|
import flask
|
||||||
|
import argparse
|
||||||
|
|
||||||
|
app = flask.Flask("webhook-listener")
|
||||||
|
|
||||||
|
##### FRONTEND PATHS ########
|
||||||
|
@app.route('/', methods=["GET","POST"])
|
||||||
|
def rootPage():
|
||||||
|
if request.method == "GET":
|
||||||
|
return "Webhook Listener ist running"
|
||||||
|
else:
|
||||||
|
data = json.loads(request.body)
|
||||||
|
print(json.dumps(data))
|
||||||
|
|
||||||
|
def readExecutionConfig():
|
||||||
|
pass
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
|
||||||
|
parser = argparse.ArgumentParser(description="Simple Webhook listener", \
|
||||||
|
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
|
||||||
|
|
||||||
|
parser.add_argument("-i", "--interface", default="0.0.0.0", help="Interface to listen on")
|
||||||
|
parser.add_argument("-p", "--port", default="5000", help="Port to listen on")
|
||||||
|
parser.add_argument("-e", "--execution-map", default="webhooks.config", help="Config for handling of webhooks")
|
||||||
|
args = parser.parse_args()
|
||||||
|
app.run(host=args.interface, port=args.port)
|
||||||
Reference in New Issue
Block a user