-
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
80ea068
commit 7fdfcb7
Showing
2 changed files
with
65 additions
and
0 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
dev_utils/code_backups/create_new_joke_if_update_joke_doesnot_exist.py
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,35 @@ | ||
# print("create new joke") | ||
|
||
# # call the add_joke api | ||
# response = call_add_joke_api(content) | ||
|
||
# # turning the response object to a dictionary | ||
# pythonified_response = response.json() | ||
# # status_code = response.status_code | ||
|
||
# new_response_dict = { | ||
# "action": "insert" , | ||
# "updated_joke_data": pythonified_response | ||
# } | ||
|
||
# if response.ok: | ||
# # Return the JSON from the response if it is successful | ||
# return ( | ||
# json.dumps(new_response_dict), | ||
# response.status_code, | ||
# {'Content-Type': 'application/json'} | ||
# ) | ||
|
||
# else: | ||
# # Handle the case where adding the joke failed | ||
|
||
# error_response = { | ||
# "success": False, | ||
# "message": "Failed to create new joke." | ||
# } | ||
|
||
# return ( | ||
# json.dumps(error_response), | ||
# response.status_code, | ||
# {'Content-Type': 'application/json'} | ||
# ) |
30 changes: 30 additions & 0 deletions
30
dev_utils/code_backups/workaround_not_to_call_get_joke_by_id.py
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,30 @@ | ||
|
||
|
||
# http://127.0.0.1:5000/api/jokes/2 | ||
|
||
# conn = sqlite3.connect(sqlite_db_path) | ||
# curs = conn.cursor() | ||
|
||
# # print(joke_id) | ||
# # print(content) | ||
|
||
# curs.execute(GET_JOKE_BY_JOKE_ID, (joke_id,)) | ||
# query_results = curs.fetchall() | ||
|
||
# conn.close() | ||
|
||
# listofdicts_query_results = [ | ||
# { | ||
# "id": item[0], | ||
# "is_active": item[1], | ||
# "joke_version_id": item[2], | ||
# "creation_timestamp": | ||
# datetime. | ||
# fromtimestamp(item[3]). | ||
# strftime('%Y-%m-%d %H:%M:%S'), | ||
# "content": item[4], | ||
# } | ||
# for item in query_results | ||
# ] | ||
|
||
# caller_app_jokes = listofdicts_query_results |