我想使用Google Drive API将Google Drive中的文件下载到我的系统中。我该如何实施呢?
根据https://developers.google.com/drive/v2/reference/files/get#examples中给出的示例
def print_file(service, file_id):
"""Print a file's metadata.
Args:
service: Drive API service instance.
file_id: ID of the file to print metadata for.
"""
try:
file = service.files().get(fileId=file_id).execute()
print 'Title: %s' % file['title']
print 'MIME type: %s' % file['mimeType']
except errors.HttpError, error:
print 'An error occurred: %s' % error
def download_file(service, drive_file):
"""Download a file's content.
Args:
service: Drive API service instance.
drive_file: Drive File instance.
Returns:
File's content if successful, None otherwise.
""" …Run Code Online (Sandbox Code Playgroud)