-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.py
32 lines (23 loc) · 1.08 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from flask import Flask, request
import logging
app = Flask(__name__)
logging.basicConfig(filename='app.log', level=logging.INFO, format='%(asctime)s %(levelname)s:%(message)s')
@app.route('/')
def hello():
client_ip = request.remote_addr
logging.info(f"===== NEW REQUEST =====")
logging.info(f"Received request from: {client_ip}")
for header, value in request.headers.items():
logging.info(f"Header: {header}, Value: {value}")
for cookie, value in request.cookies.items():
logging.info(f"Cookie: {cookie}, Value: {value}")
user_agent = request.user_agent
logging.info(f"Browser: {user_agent.browser}")
logging.info(f"Browser Version: {user_agent.version}")
logging.info(f"Platform: {user_agent.platform}")
logging.info(f"Language: {user_agent.language}")
logging.info(f"String: {user_agent.string}")
logging.info(f"===== END REQUEST =====")
return 'Your hamster points have been multiplied! 🐹🚀\nUpdates usually take about an hour to propagate'
if __name__ == '__main__':
app.run(debug=True, port=8080)