我尝试使用此 python 函数下载 Google Drive 文档(使用 Drive 应用程序)。它每次都跳到# The file doesn't have any content stored on Drive
零件。
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.
"""
download_url = drive_file.get('downloadUrl')
if download_url:
resp, content = service._http.request(download_url)
if resp.status == 200:
print 'Status: %s' % resp
return content
else:
print 'An error occurred: %s' % resp
return None
else:
# The file doesn't have any content stored on Drive.
return None
但是我从来没有得到 GDrive 文档的 HTML 内容。我的 mime 设置(HTML Mime 类型)有问题还是应该使用其他 API 函数?