Resetting utils subtree.
This commit is contained in:
@@ -43,7 +43,7 @@ sys.path.append(".")
|
||||
sys.path.append("..")
|
||||
|
||||
# For using Quart:
|
||||
from quart import Blueprint, current_app, jsonify
|
||||
from quart import Blueprint, current_app, make_response
|
||||
|
||||
# My utils:
|
||||
from utils_v2.string import json
|
||||
@@ -224,7 +224,7 @@ async def get_data(
|
||||
)
|
||||
|
||||
# Make an attempt to retrieve the credentials:
|
||||
cred_json = await current_app.mongo.find_one(
|
||||
data_json = await current_app.mongo.find_one(
|
||||
collection = JSON_TYPE_INFO[json_type]["collection"],
|
||||
filter = {"scriptId": inbound_headers["X-Script-Id"]},
|
||||
projection = {"_id": False, "scriptId": False},
|
||||
@@ -232,17 +232,23 @@ async def get_data(
|
||||
)
|
||||
|
||||
# In case no result was found:
|
||||
if cred_json is None:
|
||||
if data_json is None:
|
||||
return ResponseModel(
|
||||
status_code = StatusCodes.FAILED,
|
||||
message = "invalid script id"
|
||||
)
|
||||
|
||||
# Successfully retrieved:
|
||||
response = await make_response(json.to_string(data_json, no_space = True))
|
||||
response.headers['Content-Type'] = "application/json"
|
||||
return response
|
||||
|
||||
print("DATA:", dict(data_json))
|
||||
return json.to_string(data_json, no_space = True)
|
||||
return ResponseModel(
|
||||
status_code = StatusCodes.OK,
|
||||
data = cred_json["content"],
|
||||
message = cred_json["desc"]
|
||||
data = data_json["content"],
|
||||
message = data_json["desc"]
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user