Files
containers/webhook/webhook.py
Marco Verleun 9e640f80ef
Some checks failed
Gitea Actions Demo Training / Explore-Gitea-Actions (push) Failing after 11s
Extend info
2023-06-07 08:02:33 +02:00

27 lines
785 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')
return
webhooks = webhook_listener.Listener(handlers={"POST": process_post_request},logScreen=False)
webhooks.start()
while True:
print("Still alive....")
time.sleep(300)