Spaces:
Running
Running
plain text response
Browse files
main.py
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
import random
|
6 |
import datetime
|
7 |
from fastapi import FastAPI
|
8 |
-
from fastapi.responses import
|
9 |
|
10 |
app = FastAPI()
|
11 |
|
@@ -267,7 +267,7 @@ async def read_root():
|
|
267 |
return {"message": "Hello World"}
|
268 |
|
269 |
|
270 |
-
@app.get("/random")
|
271 |
async def read_random():
|
272 |
random.seed(datetime.date.today().isoformat())
|
273 |
return "The country of the day is: **" + random.choice(countries)["Name"] + "**"
|
|
|
5 |
import random
|
6 |
import datetime
|
7 |
from fastapi import FastAPI
|
8 |
+
from fastapi.responses import PlainTextResponse
|
9 |
|
10 |
app = FastAPI()
|
11 |
|
|
|
267 |
return {"message": "Hello World"}
|
268 |
|
269 |
|
270 |
+
@app.get("/random", response_class=PlainTextResponse)
|
271 |
async def read_random():
|
272 |
random.seed(datetime.date.today().isoformat())
|
273 |
return "The country of the day is: **" + random.choice(countries)["Name"] + "**"
|