Skip to content

Commit fc10137

Browse files
10ne1dsoprea
authored andcommitted
gdtool/chunked_download: fix broken import
After oauth2client commit 2f5c53b1fa ("Merge util.py and _helpers.py") the functionality provided by util is in _helpers. This fixes the import to work with both newer and older versions of oauth2client, until the older version gets deprecated. Signed-off-by: Ioan-Adrian Ratiu <[email protected]>
1 parent 1366b28 commit fc10137

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

gdrivefs/gdtool/chunked_download.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
import time
33
import random
44

5-
import oauth2client
5+
try:
6+
from oauth2client import util
7+
except ImportError:
8+
from oauth2client import _helpers as util
69
import apiclient.http
710
import apiclient.errors
811

@@ -19,7 +22,7 @@ class ChunkedDownload(object):
1922
that needs to be downloaded (not a request object, which doesn't apply here).
2023
"""
2124

22-
@oauth2client.util.positional(4)
25+
@util.positional(4)
2326
def __init__(self, fd, http, uri, chunksize=DEFAULT_CHUNK_SIZE, start_at=0):
2427
"""Constructor.
2528
@@ -43,7 +46,7 @@ def __init__(self, fd, http, uri, chunksize=DEFAULT_CHUNK_SIZE, start_at=0):
4346
self._sleep = time.sleep
4447
self._rand = random.random
4548

46-
@oauth2client.util.positional(1)
49+
@util.positional(1)
4750
def next_chunk(self, num_retries=0):
4851
"""Get the next chunk of the download.
4952

0 commit comments

Comments
 (0)