mayowa-1gvimy/endpoints/gospel.get.py
2025-03-25 05:44:43 +00:00

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"
}