DjPapzin commited on
Commit
b0d1bb1
1 Parent(s): d6887ce

Add a New Endpoint to Check Request Details

Browse files
Files changed (1) hide show
  1. app.py +11 -1
app.py CHANGED
@@ -1,5 +1,5 @@
1
  # Import necessary libraries and modules
2
- from fastapi import FastAPI, HTTPException
3
  from pydantic import BaseModel
4
  from pathlib import Path
5
  from dotenv import load_dotenv
@@ -60,6 +60,16 @@ def init():
60
 
61
  db, storage, chain = init()
62
 
 
 
 
 
 
 
 
 
 
 
63
  # Define API endpoint for song recommendation
64
  @app.post("/recommend", response_model=SongRecommendation)
65
  async def recommend_song(emotion: EmotionInput):
 
1
  # Import necessary libraries and modules
2
+ from fastapi import FastAPI, HTTPException, Request
3
  from pydantic import BaseModel
4
  from pathlib import Path
5
  from dotenv import load_dotenv
 
60
 
61
  db, storage, chain = init()
62
 
63
+ # Endpoint to Check Request Details
64
+ @app.get("/check_request")
65
+ async def check_request(request: Request):
66
+ return {
67
+ "base_url": str(request.base_url),
68
+ "url": str(request.url),
69
+ "client": str(request.client),
70
+ "headers": dict(request.headers),
71
+ }
72
+
73
  # Define API endpoint for song recommendation
74
  @app.post("/recommend", response_model=SongRecommendation)
75
  async def recommend_song(emotion: EmotionInput):