|
@@ -7,25 +7,29 @@ class AutoWebsiteUpdate:
|
|
|
def __init__(self):
|
|
def __init__(self):
|
|
|
pass
|
|
pass
|
|
|
|
|
|
|
|
|
|
+
|
|
|
def run(self):
|
|
def run(self):
|
|
|
- webhooks = webhook_listener.Listener(handlers={"POST": process_post_request}, port=8090)
|
|
|
|
|
|
|
+ webhooks = webhook_listener.Listener(handlers={"POST": self.process_post_request}, port=8090)
|
|
|
webhooks.start()
|
|
webhooks.start()
|
|
|
|
|
|
|
|
while True:
|
|
while True:
|
|
|
print("alive...")
|
|
print("alive...")
|
|
|
time.sleep(300)
|
|
time.sleep(300)
|
|
|
|
|
|
|
|
- def process_post_request(self, *args, **kwargs):
|
|
|
|
|
|
|
+
|
|
|
|
|
+ def process_post_request(self, request, *args, **kwargs):
|
|
|
print("Received request:\n"
|
|
print("Received request:\n"
|
|
|
+ "Method: {}\n".format(request.method)
|
|
+ "Method: {}\n".format(request.method)
|
|
|
+ "Headers: {}\n".format(request.headers)
|
|
+ "Headers: {}\n".format(request.headers)
|
|
|
+ "Args (url path): {}\n".format(args)
|
|
+ "Args (url path): {}\n".format(args)
|
|
|
+ "Keyword Args (url parameters): {}\n".format(kwargs)
|
|
+ "Keyword Args (url parameters): {}\n".format(kwargs)
|
|
|
- + "Body: {}".format(
|
|
|
|
|
- request.body.read(int(request.header["Content-Length"]))
|
|
|
|
|
- if int(request.headers.get("Content-Length", 0)) > 0
|
|
|
|
|
- else ""
|
|
|
|
|
|
|
+ + "Body: {}".format(request.body.read(int(request.header["Content-Length"]))))
|
|
|
|
|
+
|
|
|
|
|
+ if(int(request.headers.get("Content-Length", 0)) > 0):
|
|
|
|
|
+ print("content")
|
|
|
|
|
+ else:
|
|
|
|
|
+ print("no content")
|
|
|
|
|
|
|
|
-if __name__ == "__main__":
|
|
|
|
|
|
|
+if __name__ == '__main__':
|
|
|
autoWebsiteUpdate = AutoWebsiteUpdate()
|
|
autoWebsiteUpdate = AutoWebsiteUpdate()
|
|
|
autoWebsiteUpdate.run()
|
|
autoWebsiteUpdate.run()
|