【发布时间】:2017-06-07 15:05:44
【问题描述】:
使用google-api-python-client==1.6.2
fh = io.BytesIO()
request = self.drive_service.files().export_media(
fileId='1fwshPVKCACXgNxJtmGN94X-9RRrukiDs9q4s-n0nGlM',
mimeType='application/vnd.openxmlformats-officedocument.wordprocessingml.document'
)
downloader = MediaIoBaseDownload(fh, request, chunksize=1024)
done = False
while done is False:
status, done = downloader.next_chunk()
print "Download ", status.progress(), downloader._progress, downloader._total_size, done
输出:
Download 0.0 973060 None False
Download 0.0 1946120 None False
Download 0.0 2919180 None False
Download 0.0 3892240 None False
Download 0.0 4865300 None False
Download 0.0 5838360 None False
Download 0.0 6811420 None False
Download 0.0 7784480 None False
Download 0.0 8757540 None False
...
下载文件的文件大小为 973060 字节。因此,库忽略了chunksize 参数并且没有停止。永无止境。
那么,谁能告诉我是我的要求太高还是图书馆太差了?
【问题讨论】:
-
奇怪。您是否尝试过下载不同大小的文件并查看行为是否仍然相同?
-
我尝试了不同的块大小和文件。我知道
chunksize总是被忽略(一个文件在一个请求中下载)和许多其他文件没有无限循环下载。我认为这个文件类型的主要问题。它是由模板创建的 Google 文档。
标签: python google-drive-api google-api-client google-api-python-client