44 lines
862 B
Python
44 lines
862 B
Python
from fastapi import APIRouter
|
|
import random
|
|
|
|
songs = [
|
|
{
|
|
"title": "Imole De",
|
|
"album": "The Gospel of The Kingdom",
|
|
"year": 2022
|
|
},
|
|
{
|
|
"title": "Adua",
|
|
"album": "The Gospel of The Kingdom",
|
|
"year": 2022
|
|
},
|
|
{
|
|
"title": "Breathe",
|
|
"album": "The Gospel of The Kingdom",
|
|
"year": 2022
|
|
},
|
|
{
|
|
"title": "Na You",
|
|
"album": "Single",
|
|
"year": 2021
|
|
},
|
|
{
|
|
"title": "Your Love",
|
|
"album": "Single",
|
|
"year": 2020
|
|
}
|
|
]
|
|
|
|
router = APIRouter()
|
|
|
|
@router.get("/gospel")
|
|
async def get_random_song():
|
|
"""Returns a random Dunsin Oyekan song"""
|
|
random_song = random.choice(songs)
|
|
|
|
return {
|
|
"message": "Random song generated",
|
|
"song": random_song,
|
|
"method": "GET",
|
|
"_verb": "get"
|
|
} |