Spaces:
Running
Running
Update main.py
Browse files
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 |
-
|
|
|
|
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"]}**"
|