Update code in endpoints/greatest-showman.get.py
This commit is contained in:
parent
43ee4d4eba
commit
1f1196f0cf
@ -0,0 +1,67 @@
|
|||||||
|
from fastapi import APIRouter, Depends, HTTPException
|
||||||
|
from core.database import fake_users_db
|
||||||
|
import random
|
||||||
|
|
||||||
|
router = APIRouter()
|
||||||
|
|
||||||
|
greatest_showman_songs = [
|
||||||
|
{
|
||||||
|
"title": "The Greatest Show",
|
||||||
|
"performer": "Hugh Jackman",
|
||||||
|
"duration": "5:02"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "A Million Dreams",
|
||||||
|
"performer": "Ziv Zaifman, Hugh Jackman, Michelle Williams",
|
||||||
|
"duration": "4:29"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Come Alive",
|
||||||
|
"performer": "Hugh Jackman, Keala Settle",
|
||||||
|
"duration": "3:45"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "The Other Side",
|
||||||
|
"performer": "Hugh Jackman, Zac Efron",
|
||||||
|
"duration": "3:34"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Never Enough",
|
||||||
|
"performer": "Loren Allred",
|
||||||
|
"duration": "3:36"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "This Is Me",
|
||||||
|
"performer": "Keala Settle",
|
||||||
|
"duration": "3:54"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Rewrite The Stars",
|
||||||
|
"performer": "Zac Efron, Zendaya",
|
||||||
|
"duration": "3:37"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Tightrope",
|
||||||
|
"performer": "Michelle Williams",
|
||||||
|
"duration": "3:54"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "From Now On",
|
||||||
|
"performer": "Hugh Jackman",
|
||||||
|
"duration": "5:49"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
@router.get("/greatest-showman")
|
||||||
|
async def get_random_greatest_showman_song():
|
||||||
|
"""Get a random song from The Greatest Showman soundtrack"""
|
||||||
|
random_song = random.choice(greatest_showman_songs)
|
||||||
|
|
||||||
|
return {
|
||||||
|
"message": "Random song retrieved successfully",
|
||||||
|
"data": random_song,
|
||||||
|
"metadata": {
|
||||||
|
"total_songs": len(greatest_showman_songs),
|
||||||
|
"source": "The Greatest Showman Original Motion Picture Soundtrack"
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user