20 lines
724 B
Plaintext
20 lines
724 B
Plaintext
|
#!/usr/bin/python
|
||
|
from flask import Flask, request
|
||
|
|
||
|
app = Flask(__name__)
|
||
|
|
||
|
@app.route('/', defaults={'path': ''}, methods=['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'OPTIONS'])
|
||
|
@app.route('/<path:path>', methods=['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'OPTIONS'])
|
||
|
def capture_request(path):
|
||
|
"""
|
||
|
This route captures all requests, regardless of method or path.
|
||
|
"""
|
||
|
print(f"Request Path: {request.path}")
|
||
|
print(f"Request Method: {request.method}")
|
||
|
print(f"Request Headers: {dict(request.headers)}")
|
||
|
print(f"Request Body: {request.get_data(as_text=True)}")
|
||
|
return "Request captured and printed to the console!", 200
|
||
|
|
||
|
if __name__ == '__main__':
|
||
|
app.run(debug=True, host='0.0.0.0', port=5000)
|