nsarrazin HF staff commited on
Commit
e325681
1 Parent(s): dfc8dcf

plain text response

Browse files
Files changed (1) hide show
  1. main.py +2 -2
main.py CHANGED
@@ -5,7 +5,7 @@
5
  import random
6
  import datetime
7
  from fastapi import FastAPI
8
- from fastapi.responses import JSONResponse
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"] + "**"