diegokauer/segmentation-backend
0
1import json2import tempfile3import os4 5# process of getting credentials6def get_credentials():7 creds_json_str = os.getenv("creds") # get json credentials stored as a string8 if creds_json_str is None:9 raise ValueError("GOOGLE_APPLICATION_CREDENTIALS_JSON not found in environment")10 11 # create a temporary file12 with tempfile.NamedTemporaryFile(mode="w+", delete=False, suffix=".json") as temp:13 temp.write(creds_json_str) # write in json format14 temp_filename = temp.name 15 16 return temp_filename