Why can't download from shared with me in google drive

Viewed 59

I am trying to download files from shared with me in google drive. But unable to implement. When I download from my drive, its working fine. If you guys have any idea how to implement it, would help alot :)

Code:

from pydrive.auth import GoogleAuth
from pydrive.drive import GoogleDrive
import streamlit as st

gauth = GoogleAuth()
gauth.LocalWebserverAuth()
drive = GoogleDrive(gauth)

path = "/home/lungsang/Desktop/levelpack-UI/content/A0/1 docx-raw/"
folder = "1tuQxaiDOdbfv1JHXNAln2nbq1IvBOrmP"

file_list = drive.ListFile({'q': f"'{folder}' in parents and trashed=false"}).GetList()
if st.checkbox("Show file list?", True):
    for index, file in enumerate(file_list):
        st.write(index + 1, file['title'])
        file.GetContentFile(path + file['title'])

settings.yaml :

client_config_backend: settings
client_config:
  client_id: 556191342382-tbsh3m4jdh21j2jlnjarchkufljbsoec.apps.googleusercontent.com
  client_secret: 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

save_credentials: True
save_credentials_backend: file
save_credentials_file: credentials.json

get_refresh_token: True

oauth_scope:
  - https://www.googleapis.com/auth/drive.file
  - https://www.googleapis.com/auth/drive.install
  - https://www.googleapis.com/auth/drive
  - https://www.googleapis.com/auth/drive.metadata
0 Answers
Related