Spaces:
Sleeping
Sleeping
File size: 651 Bytes
ea3ced9 e52ab8f 061a06f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
import json
import tempfile
# process of getting credentials
def get_credentials():
creds_json_str = os.getenv("creds") # get json credentials stored as a string
if creds_json_str is None:
raise ValueError("GOOGLE_APPLICATION_CREDENTIALS_JSON not found in environment")
# create a temporary file
with tempfile.NamedTemporaryFile(mode="w+", delete=False, suffix=".json") as temp:
temp.write(creds_json_str) # write in json format
temp_filename = temp.name
return temp_filename
# pass
os.environ["GOOGLE_APPLICATION_CREDENTIALS"]= get_credentials()
print("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA") |