@@ -201,7 +201,7 @@ class StorageStreamDownloader(object): # pylint: disable=too-many-instance-attr
201
201
The properties of the file being downloaded. If only a range of the data is being
202
202
downloaded, this will be reflected in the properties.
203
203
:ivar int size:
204
- The size of the total data in the stream. This will be the byte range if speficied ,
204
+ The size of the total data in the stream. This will be the byte range if specified ,
205
205
otherwise the total size of the file.
206
206
"""
207
207
@@ -311,7 +311,7 @@ def _initial_request(self):
311
311
# Parse the total file size and adjust the download size if ranges
312
312
# were specified
313
313
self ._file_size = parse_length_from_content_range (response .properties .content_range )
314
- if not self ._file_size :
314
+ if self ._file_size is None :
315
315
raise ValueError ("Required Content-Range response header is missing or malformed." )
316
316
317
317
if self ._end_range is not None :
@@ -323,7 +323,7 @@ def _initial_request(self):
323
323
self .size = self ._file_size
324
324
325
325
except HttpResponseError as error :
326
- if self ._start_range is None and error .response .status_code == 416 :
326
+ if self ._start_range is None and error .response and error . response .status_code == 416 :
327
327
# Get range will fail on an empty file. If the user did not
328
328
# request a range, do a regular get request in order to get
329
329
# any properties.
@@ -398,10 +398,12 @@ def readall(self):
398
398
return data
399
399
400
400
def content_as_bytes (self , max_concurrency = 1 ):
401
- """Download the contents of this file.
401
+ """DEPRECATED: Download the contents of this file.
402
402
403
403
This operation is blocking until all data is downloaded.
404
404
405
+ This method is deprecated, use func:`readall` instead.
406
+
405
407
:keyword int max_concurrency:
406
408
The number of parallel connections with which to download.
407
409
:rtype: bytes
@@ -414,10 +416,12 @@ def content_as_bytes(self, max_concurrency=1):
414
416
return self .readall ()
415
417
416
418
def content_as_text (self , max_concurrency = 1 , encoding = "UTF-8" ):
417
- """Download the contents of this file, and decode as text.
419
+ """DEPRECATED: Download the contents of this file, and decode as text.
418
420
419
421
This operation is blocking until all data is downloaded.
420
422
423
+ This method is deprecated, use func:`readall` instead.
424
+
421
425
:keyword int max_concurrency:
422
426
The number of parallel connections with which to download.
423
427
:param str encoding:
@@ -495,7 +499,9 @@ def readinto(self, stream):
495
499
return self .size
496
500
497
501
def download_to_stream (self , stream , max_concurrency = 1 ):
498
- """Download the contents of this file to a stream.
502
+ """DEPRECATED: Download the contents of this file to a stream.
503
+
504
+ This method is deprecated, use func:`readinto` instead.
499
505
500
506
:param stream:
501
507
The stream to download to. This can be an open file-handle,
0 commit comments