From bba783203cfeeb9c53f814a4319a3b17e04df9de Mon Sep 17 00:00:00 2001 From: Costin Anghel Date: Thu, 4 Jan 2024 15:21:38 -0500 Subject: [PATCH 1/2] Added handling for partial downlads to MediaIoBaseDownload() --- googleapiclient/http.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/googleapiclient/http.py b/googleapiclient/http.py index 187f6f5dac8..61a12bfc0e4 100644 --- a/googleapiclient/http.py +++ b/googleapiclient/http.py @@ -682,7 +682,7 @@ class MediaIoBaseDownload(object): """ @util.positional(3) - def __init__(self, fd, request, chunksize=DEFAULT_CHUNK_SIZE): + def __init__(self, fd, request, chunksize=DEFAULT_CHUNK_SIZE, start=0): """Constructor. Args: @@ -696,7 +696,7 @@ def __init__(self, fd, request, chunksize=DEFAULT_CHUNK_SIZE): self._request = request self._uri = request.uri self._chunksize = chunksize - self._progress = 0 + self._progress = start self._total_size = None self._done = False From 3ea3d35fcb863cd16976c20f71186437b0ba3eaa Mon Sep 17 00:00:00 2001 From: Costin Anghel Date: Thu, 4 Jan 2024 15:21:38 -0500 Subject: [PATCH 2/2] feat: handling for partial downlads --- googleapiclient/http.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/googleapiclient/http.py b/googleapiclient/http.py index 187f6f5dac8..61a12bfc0e4 100644 --- a/googleapiclient/http.py +++ b/googleapiclient/http.py @@ -682,7 +682,7 @@ class MediaIoBaseDownload(object): """ @util.positional(3) - def __init__(self, fd, request, chunksize=DEFAULT_CHUNK_SIZE): + def __init__(self, fd, request, chunksize=DEFAULT_CHUNK_SIZE, start=0): """Constructor. Args: @@ -696,7 +696,7 @@ def __init__(self, fd, request, chunksize=DEFAULT_CHUNK_SIZE): self._request = request self._uri = request.uri self._chunksize = chunksize - self._progress = 0 + self._progress = start self._total_size = None self._done = False