46 lines
1.2 KiB
Python
46 lines
1.2 KiB
Python
from fastapi import APIRouter
|
|
import random
|
|
|
|
musicians = [
|
|
{
|
|
"name": "Sinach",
|
|
"hits": ["Way Maker", "I Know Who I Am", "Great Are You Lord"],
|
|
"years_active": "2002-present"
|
|
},
|
|
{
|
|
"name": "Nathaniel Bassey",
|
|
"hits": ["Imela", "Onise Iyanu", "Olowogbogboro"],
|
|
"years_active": "2008-present"
|
|
},
|
|
{
|
|
"name": "Mercy Chinwo",
|
|
"hits": ["Excess Love", "Chinedum", "Onyedikagi"],
|
|
"years_active": "2012-present"
|
|
},
|
|
{
|
|
"name": "Frank Edwards",
|
|
"hits": ["Mma Mma", "You Too Dey Bless Me", "If God Be For Me"],
|
|
"years_active": "2008-present"
|
|
},
|
|
{
|
|
"name": "Tim Godfrey",
|
|
"hits": ["Nara", "Agidigba", "Na You Be God"],
|
|
"years_active": "2006-present"
|
|
}
|
|
]
|
|
|
|
router = APIRouter()
|
|
|
|
@router.get("/liverpool")
|
|
async def get_random_musician():
|
|
"""Returns a random Nigerian gospel musician"""
|
|
musician = random.choice(musicians)
|
|
return {
|
|
"method": "GET",
|
|
"_verb": "get",
|
|
"musician": musician,
|
|
"features": {
|
|
"total_musicians": len(musicians),
|
|
"random_selection": True
|
|
}
|
|
} |