Update code in endpoints/colour.get.py
This commit is contained in:
parent
1182307ece
commit
537333bf58
@ -0,0 +1,11 @@
|
||||
from fastapi import APIRouter, status
|
||||
from typing import Dict
|
||||
import random
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
@router.get("/colour", status_code=status.HTTP_200_OK, response_model=Dict[str, str])
|
||||
async def get_random_color():
|
||||
"""Get a random color in hexadecimal format"""
|
||||
color = "#{:06x}".format(random.randint(0, 0xFFFFFF))
|
||||
return {"color": color}
|
Loading…
x
Reference in New Issue
Block a user