-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
709fbc5
commit 4ceed09
Showing
3 changed files
with
32 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from fastapi.responses import JSONResponse | ||
import random | ||
|
||
|
||
def form_correct_format(content): | ||
return JSONResponse(content=content, media_type="application/json; charset=utf-8") | ||
|
||
def get_word_response(words_list): | ||
content = {"word": random.choice(words_list)} | ||
return form_correct_format(content) | ||
|
||
def get_words_list_response(words_list): | ||
content = {"words": words_list} | ||
return form_correct_format(content) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters