This is a sample script for achieving the resumable download of a file from Google Drive using Dive API with Python.
There might be a case in that you want to achieve the resumable download of a file from Google Drive using Dive API with Python. For example, when a large file is downloaded, the downloading might be stopped in the middle of downloading. At that time, you might want to resume the download. In this post, I would like to introduce the sample script of python.
In order to achieve the partial download from Google Drive, the property of Range: bytes=500-999
is required to be included in the request header. But, unfortunately, in the current stage, MediaIoBaseDownload
cannot use this property. When MediaIoBaseDownload
is used, all data is downloaded.
So, in order to achieve this goal, it is required to use a workaround. In this workaround, I proposed the following flow.