def _sync_download(self, url, destination_path):
Synchronous version of `download` method.
checksum = self._checksumer()
session = requests.Session()
if _DRIVE_URL.match(url):
url = self._get_drive_url(url, session)
response = session.get(url, stream=True)
fname = util.get_file_name(response.url)
path = os.path.join(destination_path, fname)
with gfile.Open(path, "wb") as file_:
for block in response.iter_content(chunk_size=io.DEFAULT_BUFFER_SIZE):
checksum.update(block)
// TODO(pierrot): Test this is faster than doing checksum in the end