Tôi đang cố gắng tải danh sách các tệp trong Google Drive của mình bằng ứng dụng dành cho máy tính để bàn. Mã này là như sau:Không có tệp Google Drive nào được liệt kê trong yêu cầu API Drive
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)
Sau đó, trong retrieve_all_files, tôi in các tập tin:
param = {}
if page_token:
param['pageToken'] = page_token
files = service.files().list(**param).execute()
print files
Nhưng sau khi tôi xác thực tài khoản của tôi, danh sách tập tin in có tin nào. Có ai có một vấn đề tương tự hoặc biết một giải pháp cho điều này?
Bạn có thể dán toàn bộ truy xuất_all_files không? Nó trông giống như một chức năng hữu ích. –
@ AliAfshar, bạn có thể tìm thấy ở đây: https://developers.google.com/drive/v2/reference/files/list –