-
-
Save u1i/f87fefc80b5a7be3a89034f88d2ed58d to your computer and use it in GitHub Desktop.
HTTP Listener
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask, request | |
app = Flask(__name__) | |
@app.route('/', defaults={'path': ''}, methods=["GET", "POST", "PUT", "DELETE"]) | |
@app.route('/<path:path>', methods=["GET", "POST", "PUT", "DELETE"]) | |
def catch_all(path): | |
# Print the incoming request and payload | |
print(f"Incoming Request: {request.method} {request.url}") | |
if request.data: | |
print(f"Request Payload: {request.data.decode('utf-8')}") | |
return '', 200 | |
if __name__ == '__main__': | |
app.run(host='0.0.0.0', port=8080) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment