Files
containers/webhook/webhook.py
Marco Verleun b6e70b4cac
Some checks failed
Gitea Actions Demo Training / Explore-Gitea-Actions (push) Failing after 14s
Fixed files
2024-01-07 21:17:15 +01:00

29 lines
843 B
Python

import time
import os
import webhook_listener
def process_post_request(request, *args, **kwargs):
print(
"Received request:\n"
+ "Method: {}\n".format(request.method)
+ "Headers: {}\n".format(request.headers)
+ "Args (url path): {}\n".format(args)
+ "Keyword Args (url parameters): {}\n".format(kwargs)
# + "Body: {}".format(
# request.body.read(int(request.headers["Content-Length"]))
# if int(request.headers.get("Content-Length", 0)) > 0
# else ""
# )
)
# Process request here
os.system('git pull')
os.system('cd ../slides; ./build.sh once')
return
webhooks = webhook_listener.Listener(handlers={"POST": process_post_request},logScreen=False)
webhooks.start()
while True:
print("Still alive....")
time.sleep(300)