我正在尝试使用桌面应用程序获取我的Google Drive中文件列表的方法。代码如下:
然后在retrieve_all_files函数中,我打印出了文件:
def main(argv):
storage = Storage('drive.dat')
credentials = storage.get()
if credentials is None or credentials.invalid:
credentials = run(FLOW, storage)
# Create an httplib2.Http object to handle our HTTP requests and authorize it
# with our good Credentials.
http = httplib2.Http()
http = credentials.authorize(http)
service = build("drive", "v2", http=http)
retrieve_all_files(service)
然后在retrieve_all_files函数中,我打印出了文件:
param = {}
if page_token:
param['pageToken'] = page_token
files = service.files().list(**param).execute()
print files
但是在我认证我的账户之后,打印的文件列表中没有任何项目。是否有人遇到类似的问题或知道解决方法?