sp-hydra-veil-core/app/utils/get_raw_string.py
2026-05-26 18:29:24 -05:00

25 lines
760 B
Python

from core.Constants import Constants
import os
# gets a raw string, but unlike the other function, does not convert it to a JSON.
def get_raw_string(which_ticket, name_of_file_and_folder):
data_folder = Constants.HV_TICKETING_DATA_HOME
folder_path = f"{data_folder}/{name_of_file_and_folder}"
# make sure folder exists:
if not os.path.exists(folder_path):
os.makedirs(folder_path)
# setup path:
which_ticket_as_string = str(which_ticket)
where_is_the_data = (
f"{folder_path}/{name_of_file_and_folder}_{which_ticket_as_string}.json"
)
try:
with open(where_is_the_data, "r") as file:
raw_string_content = file.read()
return raw_string_content
except:
return False