Hello everyone,
I have created an app which takes some info from the user and uploads it to Google Sheets (simple database). I have also added an upload file widget which is supposed to upload a file from the user to drive using the pydrive library. This worked perfectly before deploying the app, but now I am having problems with it. The error I am getting is:
File "/home/appuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 552, in _run_script
exec(code, module.__dict__)
File "/app/testing/project.py", line 409, in <module>
main()
File "/app/testing/project.py", line 262, in main
gfile.Upload()
File "/home/appuser/venv/lib/python3.9/site-packages/pydrive/files.py", line 285, in Upload
self._FilesInsert(param=param)
File "/home/appuser/venv/lib/python3.9/site-packages/pydrive/auth.py", line 57, in _decorated
self.auth.LocalWebserverAuth()
File "/home/appuser/venv/lib/python3.9/site-packages/pydrive/auth.py", line 115, in _decorated
code = decoratee(self, *args, **kwargs)
File "/home/appuser/venv/lib/python3.9/site-packages/pydrive/auth.py", line 224, in LocalWebserverAuth
raise AuthenticationError()```
Code snippet of my code which produces the error:
with NamedTemporaryFile() as f:
gauth = GoogleAuth()
#gauth.LocalWebserverAuth()
drive = GoogleDrive(gauth)
client_json_path = 'path'
GoogleAuth.DEFAULT_SETTINGS['client_config_file'] = client_json_path
drive_key = st.secrets["drive_key"]
f.write(cv.getvalue())
gfile = drive.CreateFile({"parents": [{"id": drive_key}], "title": cv.name})
st.write(gfile)
gfile.SetContentFile(f.name)
gfile.Upload()
st.write("success")
Thanks in advance for any help