Skip to content

Instantly share code, notes, and snippets.

@u1i
Created October 25, 2023 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save u1i/f87fefc80b5a7be3a89034f88d2ed58d to your computer and use it in GitHub Desktop.
Save u1i/f87fefc80b5a7be3a89034f88d2ed58d to your computer and use it in GitHub Desktop.
HTTP Listener
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