Update code in endpoints/greatest-showman.get.py
This commit is contained in:
parent
c209fafda6
commit
27f24ede17
@ -0,0 +1,32 @@
|
|||||||
|
from fastapi import APIRouter
|
||||||
|
import random
|
||||||
|
|
||||||
|
songs = [
|
||||||
|
"The Greatest Show",
|
||||||
|
"A Million Dreams",
|
||||||
|
"Come Alive",
|
||||||
|
"The Other Side",
|
||||||
|
"Never Enough",
|
||||||
|
"This Is Me",
|
||||||
|
"Rewrite The Stars",
|
||||||
|
"Tightrope",
|
||||||
|
"From Now On"
|
||||||
|
]
|
||||||
|
|
||||||
|
router = APIRouter()
|
||||||
|
|
||||||
|
@router.get("/greatest-showman")
|
||||||
|
async def random_showman_song():
|
||||||
|
"""Get a random song from The Greatest Showman"""
|
||||||
|
song = random.choice(songs)
|
||||||
|
|
||||||
|
return {
|
||||||
|
"message": "Random song retrieved",
|
||||||
|
"song": song,
|
||||||
|
"method": "GET",
|
||||||
|
"_verb": "get",
|
||||||
|
"features": {
|
||||||
|
"total_songs": len(songs),
|
||||||
|
"movie": "The Greatest Showman"
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user