I have API built with FastAPI
from fastapi import FastAPI
from typing import Optional
import uvicorn
app = FastAPI()
class User(BaseModel):
username: str
user_list = ["John", "Abrahim", "Kiana"]
#Get method to fetch some value
@app.get('/user/{id}/')
def users(id:int):
return user_list[id]
if __name__ == "__main__":
uvicorn.run(app, host="127.0.0.1",port=8000)
How I can achieve Service Timeout for this API? Will be thankful for the suggestions and written example if possible.