Sorry for my poor english and i am a beginner of pydrive user. now i am trying to get all the files names from my google drive. here is my drive.py:
from pydrive.auth import GoogleAuth
from pydrive.drive import GoogleDrive
gauth = GoogleAuth()
gauth.CommandLineAuth()
drive = GoogleDrive(gauth)
file1 = drive.CreateFile({'title': 'Hello.txt'}) # Create GoogleDriveFile instance with title 'Hello.txt'.
file1.SetContentString('Hello World!') # Set content of the file from given string.
file1.Upload()
for file_list in drive.ListFile({'q': "'root' in parents and trashed=false"}):
print('Received %s files from Files.list()' % len(file_list)) # <= 10
for file1 in file_list:
print('title: %s, id: %s' % (file1['title'], file1['id']))
and here is my setting files:
client_config_backend: settings
client_config:
client_id: XXXX
client_secret: YYYYY
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.metadata
and there is the result:
Received 1 files from Files.list()
title: Hello.txt, id: xxxxxx
the question is , i can only get the files 'hello.txt' that created above but not only created from the webinterface in goole drive. Is there any wrong inside my setting file or query?
Sorry again for my poor english and hope everyone will have a nice day.