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

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +3 -7
main.py CHANGED
@@ -261,13 +261,9 @@ countries = [
261
  {"Name": "Åland Islands", "Code": "AX"},
262
  ]
263
 
264
-
265
- @app.get("/")
266
- async def read_root():
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"] + "**"
 
 
261
  {"Name": "Åland Islands", "Code": "AX"},
262
  ]
263
 
 
 
 
 
 
 
264
  @app.get("/random", response_class=PlainTextResponse)
265
  async def read_random():
266
+ # use the day as a seed, so a new country gets used every day
267
  random.seed(datetime.date.today().isoformat())
268
+
269
+ return f"The country of the day is: **{random.choice(countries)["Name"]}**"