Mr-Help commited on
Commit
2ad00a1
Β·
verified Β·
1 Parent(s): a8ead29

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +4 -2
main.py CHANGED
@@ -1,20 +1,22 @@
1
  # main.py
2
  from fastapi import FastAPI, Request, UploadFile
3
  from typing import Any, Dict
 
4
 
5
  app = FastAPI()
6
 
7
  @app.post("/echo")
8
  async def echo(request: Request) -> Dict[str, Any]:
9
  body_bytes = await request.body()
 
10
 
11
- print("\n" + "="*30 + " πŸ†• NEW REQUEST " + "="*30)
12
  # print("πŸ”Ή Method:", request.method)
13
  # print("🌐 URL:", str(request.url))
14
  # print("πŸ“‘ Headers:", dict(request.headers))
15
  # print("\nπŸ“¦ Raw body (bytes):")
16
  # print(body_bytes)
17
- print("\nπŸ“ Request body:")
18
  print(body_bytes.decode("utf-8", errors="ignore"))
19
  print("="*75)
20
 
 
1
  # main.py
2
  from fastapi import FastAPI, Request, UploadFile
3
  from typing import Any, Dict
4
+ from datetime import datetime
5
 
6
  app = FastAPI()
7
 
8
  @app.post("/echo")
9
  async def echo(request: Request) -> Dict[str, Any]:
10
  body_bytes = await request.body()
11
+ now = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
12
 
13
+ print("\n" + "="*30 + f" πŸ†• NEW REQUEST ({now}) " + "="*30)
14
  # print("πŸ”Ή Method:", request.method)
15
  # print("🌐 URL:", str(request.url))
16
  # print("πŸ“‘ Headers:", dict(request.headers))
17
  # print("\nπŸ“¦ Raw body (bytes):")
18
  # print(body_bytes)
19
+ print("πŸ“ Request body:")
20
  print(body_bytes.decode("utf-8", errors="ignore"))
21
  print("="*75)
22