I’m using the Google Drive API for a project, which now I want to move to Streamlit.
I was using a
client_secrets.json to create the API service using a function provided by Google:
CLIENT_SECRET_FILE = 'client_secrets.json' # 👈 JSON File with the API KEY and other config stuff API_NAME = 'drive' API_VERSION = 'v3' SCOPES = ['https://www.googleapis.com/auth/drive'] #This function expects a json file/route as the "CLIENT_SECRET_FILE" parameter 👇 service = Create_Service(CLIENT_SECRET_FILE, API_NAME, API_VERSION, SCOPES)
I know about the
secrets.toml and already created it using the content of the
Now, when I declare
CLIENT_SECRET_FILE = st.secrets['something'] #or CLIENT_SECRET_FILE = st.secrets
I get this error:
with open(client_secrets_file, "r") as json_file: TypeError: expected str, bytes or os.PathLike object, not Secrets
How can I use the
Create_Service() function using TOML instead of JSON?
Thanks for your help!!!