azure-storage-blob 12.21.0b1__py3-none-any.whl → 12.23.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- azure/storage/blob/__init__.py +19 -18
- azure/storage/blob/_blob_client.py +470 -1555
- azure/storage/blob/_blob_client_helpers.py +1242 -0
- azure/storage/blob/_blob_service_client.py +93 -112
- azure/storage/blob/_blob_service_client_helpers.py +27 -0
- azure/storage/blob/_container_client.py +176 -377
- azure/storage/blob/_container_client_helpers.py +266 -0
- azure/storage/blob/_deserialize.py +68 -44
- azure/storage/blob/_download.py +375 -241
- azure/storage/blob/_encryption.py +14 -7
- azure/storage/blob/_generated/_azure_blob_storage.py +2 -1
- azure/storage/blob/_generated/_serialization.py +2 -0
- azure/storage/blob/_generated/aio/_azure_blob_storage.py +2 -1
- azure/storage/blob/_generated/aio/operations/_append_blob_operations.py +1 -7
- azure/storage/blob/_generated/aio/operations/_blob_operations.py +21 -47
- azure/storage/blob/_generated/aio/operations/_block_blob_operations.py +2 -10
- azure/storage/blob/_generated/aio/operations/_container_operations.py +13 -26
- azure/storage/blob/_generated/aio/operations/_page_blob_operations.py +3 -14
- azure/storage/blob/_generated/aio/operations/_service_operations.py +14 -17
- azure/storage/blob/_generated/operations/_append_blob_operations.py +1 -7
- azure/storage/blob/_generated/operations/_blob_operations.py +21 -47
- azure/storage/blob/_generated/operations/_block_blob_operations.py +2 -10
- azure/storage/blob/_generated/operations/_container_operations.py +13 -26
- azure/storage/blob/_generated/operations/_page_blob_operations.py +3 -14
- azure/storage/blob/_generated/operations/_service_operations.py +14 -17
- azure/storage/blob/_generated/py.typed +1 -0
- azure/storage/blob/_lease.py +52 -63
- azure/storage/blob/_list_blobs_helper.py +129 -135
- azure/storage/blob/_models.py +480 -277
- azure/storage/blob/_quick_query_helper.py +30 -31
- azure/storage/blob/_serialize.py +39 -56
- azure/storage/blob/_shared/avro/datafile.py +1 -1
- azure/storage/blob/_shared/avro/datafile_async.py +1 -1
- azure/storage/blob/_shared/base_client.py +3 -1
- azure/storage/blob/_shared/base_client_async.py +1 -1
- azure/storage/blob/_shared/policies.py +16 -15
- azure/storage/blob/_shared/policies_async.py +21 -6
- azure/storage/blob/_shared/response_handlers.py +6 -2
- azure/storage/blob/_shared/shared_access_signature.py +21 -3
- azure/storage/blob/_shared/uploads.py +1 -1
- azure/storage/blob/_shared/uploads_async.py +1 -1
- azure/storage/blob/_shared_access_signature.py +110 -52
- azure/storage/blob/_upload_helpers.py +75 -68
- azure/storage/blob/_version.py +1 -1
- azure/storage/blob/aio/__init__.py +19 -11
- azure/storage/blob/aio/_blob_client_async.py +554 -301
- azure/storage/blob/aio/_blob_service_client_async.py +148 -97
- azure/storage/blob/aio/_container_client_async.py +289 -140
- azure/storage/blob/aio/_download_async.py +485 -337
- azure/storage/blob/aio/_lease_async.py +61 -60
- azure/storage/blob/aio/_list_blobs_helper.py +94 -96
- azure/storage/blob/aio/_models.py +60 -38
- azure/storage/blob/aio/_upload_helpers.py +75 -66
- {azure_storage_blob-12.21.0b1.dist-info → azure_storage_blob-12.23.0.dist-info}/METADATA +7 -7
- azure_storage_blob-12.23.0.dist-info/RECORD +84 -0
- {azure_storage_blob-12.21.0b1.dist-info → azure_storage_blob-12.23.0.dist-info}/WHEEL +1 -1
- azure/storage/blob/_generated/_vendor.py +0 -16
- azure_storage_blob-12.21.0b1.dist-info/RECORD +0 -81
- {azure_storage_blob-12.21.0b1.dist-info → azure_storage_blob-12.23.0.dist-info}/LICENSE +0 -0
- {azure_storage_blob-12.21.0b1.dist-info → azure_storage_blob-12.23.0.dist-info}/top_level.txt +0 -0
@@ -47,6 +47,10 @@ _GCM_TAG_LENGTH = 16
|
|
47
47
|
_ERROR_OBJECT_INVALID = \
|
48
48
|
'{0} does not define a complete interface. Value of {1} is either missing or invalid.'
|
49
49
|
|
50
|
+
_ERROR_UNSUPPORTED_METHOD_FOR_ENCRYPTION = (
|
51
|
+
'The require_encryption flag is set, but encryption is not supported'
|
52
|
+
' for this method.')
|
53
|
+
|
50
54
|
|
51
55
|
class KeyEncryptionKey(Protocol):
|
52
56
|
|
@@ -357,7 +361,7 @@ def get_adjusted_upload_size(length: int, encryption_version: str) -> int:
|
|
357
361
|
def get_adjusted_download_range_and_offset(
|
358
362
|
start: int,
|
359
363
|
end: int,
|
360
|
-
length: int,
|
364
|
+
length: Optional[int],
|
361
365
|
encryption_data: Optional[_EncryptionData]) -> Tuple[Tuple[int, int], Tuple[int, int]]:
|
362
366
|
"""
|
363
367
|
Gets the new download range and offsets into the decrypted data for
|
@@ -374,7 +378,7 @@ def get_adjusted_download_range_and_offset(
|
|
374
378
|
|
375
379
|
:param int start: The user-requested start index.
|
376
380
|
:param int end: The user-requested end index.
|
377
|
-
:param int length: The user-requested length. Only used for V1.
|
381
|
+
:param Optional[int] length: The user-requested length. Only used for V1.
|
378
382
|
:param Optional[_EncryptionData] encryption_data: The encryption data to determine version and sizes.
|
379
383
|
:return: (new start, new end), (start offset, end offset)
|
380
384
|
:rtype: Tuple[Tuple[int, int], Tuple[int, int]]
|
@@ -451,17 +455,20 @@ def parse_encryption_data(metadata: Dict[str, Any]) -> Optional[_EncryptionData]
|
|
451
455
|
return None
|
452
456
|
|
453
457
|
|
454
|
-
def adjust_blob_size_for_encryption(size: int, encryption_data: _EncryptionData) -> int:
|
458
|
+
def adjust_blob_size_for_encryption(size: int, encryption_data: Optional[_EncryptionData]) -> int:
|
455
459
|
"""
|
456
460
|
Adjusts the given blob size for encryption by subtracting the size of
|
457
461
|
the encryption data (nonce + tag). This only has an affect for encryption V2.
|
458
462
|
|
459
463
|
:param int size: The original blob size.
|
460
|
-
:param _EncryptionData encryption_data: The encryption data to determine version and sizes.
|
464
|
+
:param Optional[_EncryptionData] encryption_data: The encryption data to determine version and sizes.
|
461
465
|
:return: The new blob size.
|
462
466
|
:rtype: int
|
463
467
|
"""
|
464
|
-
if
|
468
|
+
if (encryption_data is not None and
|
469
|
+
encryption_data.encrypted_region_info is not None and
|
470
|
+
is_encryption_v2(encryption_data)):
|
471
|
+
|
465
472
|
nonce_length = encryption_data.encrypted_region_info.nonce_length
|
466
473
|
data_length = encryption_data.encrypted_region_info.data_length
|
467
474
|
tag_length = encryption_data.encrypted_region_info.tag_length
|
@@ -836,7 +843,7 @@ def generate_blob_encryption_data(
|
|
836
843
|
|
837
844
|
def decrypt_blob( # pylint: disable=too-many-locals,too-many-statements
|
838
845
|
require_encryption: bool,
|
839
|
-
key_encryption_key: KeyEncryptionKey,
|
846
|
+
key_encryption_key: Optional[KeyEncryptionKey],
|
840
847
|
key_resolver: Optional[Callable[[str], KeyEncryptionKey]],
|
841
848
|
content: bytes,
|
842
849
|
start_offset: int,
|
@@ -848,7 +855,7 @@ def decrypt_blob( # pylint: disable=too-many-locals,too-many-statements
|
|
848
855
|
|
849
856
|
:param bool require_encryption:
|
850
857
|
Whether the calling blob service requires objects to be decrypted.
|
851
|
-
:param KeyEncryptionKey key_encryption_key:
|
858
|
+
:param Optional[KeyEncryptionKey] key_encryption_key:
|
852
859
|
The user-provided key-encryption-key. Must implement the following methods:
|
853
860
|
wrap_key(key)
|
854
861
|
- Wraps the specified key using an algorithm of the user's choice.
|
@@ -8,6 +8,7 @@
|
|
8
8
|
|
9
9
|
from copy import deepcopy
|
10
10
|
from typing import Any
|
11
|
+
from typing_extensions import Self
|
11
12
|
|
12
13
|
from azure.core import PipelineClient
|
13
14
|
from azure.core.pipeline import policies
|
@@ -110,7 +111,7 @@ class AzureBlobStorage: # pylint: disable=client-accepts-api-version-keyword
|
|
110
111
|
def close(self) -> None:
|
111
112
|
self._client.close()
|
112
113
|
|
113
|
-
def __enter__(self) ->
|
114
|
+
def __enter__(self) -> Self:
|
114
115
|
self._client.__enter__()
|
115
116
|
return self
|
116
117
|
|
@@ -144,6 +144,8 @@ class RawDeserializer:
|
|
144
144
|
# context otherwise.
|
145
145
|
_LOGGER.critical("Wasn't XML not JSON, failing")
|
146
146
|
raise DeserializationError("XML is invalid") from err
|
147
|
+
elif content_type.startswith("text/"):
|
148
|
+
return data_as_str
|
147
149
|
raise DeserializationError("Cannot deserialize content-type: {}".format(content_type))
|
148
150
|
|
149
151
|
@classmethod
|
@@ -8,6 +8,7 @@
|
|
8
8
|
|
9
9
|
from copy import deepcopy
|
10
10
|
from typing import Any, Awaitable
|
11
|
+
from typing_extensions import Self
|
11
12
|
|
12
13
|
from azure.core import AsyncPipelineClient
|
13
14
|
from azure.core.pipeline import policies
|
@@ -112,7 +113,7 @@ class AzureBlobStorage: # pylint: disable=client-accepts-api-version-keyword
|
|
112
113
|
async def close(self) -> None:
|
113
114
|
await self._client.close()
|
114
115
|
|
115
|
-
async def __aenter__(self) ->
|
116
|
+
async def __aenter__(self) -> Self:
|
116
117
|
await self._client.__aenter__()
|
117
118
|
return self
|
118
119
|
|
@@ -19,13 +19,11 @@ from azure.core.exceptions import (
|
|
19
19
|
map_error,
|
20
20
|
)
|
21
21
|
from azure.core.pipeline import PipelineResponse
|
22
|
-
from azure.core.
|
23
|
-
from azure.core.rest import HttpRequest
|
22
|
+
from azure.core.rest import AsyncHttpResponse, HttpRequest
|
24
23
|
from azure.core.tracing.decorator_async import distributed_trace_async
|
25
24
|
from azure.core.utils import case_insensitive_dict
|
26
25
|
|
27
26
|
from ... import models as _models
|
28
|
-
from ..._vendor import _convert_request
|
29
27
|
from ...operations._append_blob_operations import (
|
30
28
|
build_append_block_from_url_request,
|
31
29
|
build_append_block_request,
|
@@ -207,7 +205,6 @@ class AppendBlobOperations:
|
|
207
205
|
headers=_headers,
|
208
206
|
params=_params,
|
209
207
|
)
|
210
|
-
_request = _convert_request(_request)
|
211
208
|
_request.url = self._client.format_url(_request.url)
|
212
209
|
|
213
210
|
_stream = False
|
@@ -372,7 +369,6 @@ class AppendBlobOperations:
|
|
372
369
|
headers=_headers,
|
373
370
|
params=_params,
|
374
371
|
)
|
375
|
-
_request = _convert_request(_request)
|
376
372
|
_request.url = self._client.format_url(_request.url)
|
377
373
|
|
378
374
|
_stream = False
|
@@ -574,7 +570,6 @@ class AppendBlobOperations:
|
|
574
570
|
headers=_headers,
|
575
571
|
params=_params,
|
576
572
|
)
|
577
|
-
_request = _convert_request(_request)
|
578
573
|
_request.url = self._client.format_url(_request.url)
|
579
574
|
|
580
575
|
_stream = False
|
@@ -696,7 +691,6 @@ class AppendBlobOperations:
|
|
696
691
|
headers=_headers,
|
697
692
|
params=_params,
|
698
693
|
)
|
699
|
-
_request = _convert_request(_request)
|
700
694
|
_request.url = self._client.format_url(_request.url)
|
701
695
|
|
702
696
|
_stream = False
|
@@ -16,16 +16,16 @@ from azure.core.exceptions import (
|
|
16
16
|
ResourceExistsError,
|
17
17
|
ResourceNotFoundError,
|
18
18
|
ResourceNotModifiedError,
|
19
|
+
StreamClosedError,
|
20
|
+
StreamConsumedError,
|
19
21
|
map_error,
|
20
22
|
)
|
21
23
|
from azure.core.pipeline import PipelineResponse
|
22
|
-
from azure.core.
|
23
|
-
from azure.core.rest import HttpRequest
|
24
|
+
from azure.core.rest import AsyncHttpResponse, HttpRequest
|
24
25
|
from azure.core.tracing.decorator_async import distributed_trace_async
|
25
26
|
from azure.core.utils import case_insensitive_dict
|
26
27
|
|
27
28
|
from ... import models as _models
|
28
|
-
from ..._vendor import _convert_request
|
29
29
|
from ...operations._blob_operations import (
|
30
30
|
build_abort_copy_from_url_request,
|
31
31
|
build_acquire_lease_request,
|
@@ -194,9 +194,9 @@ class BlobOperations: # pylint: disable=too-many-public-methods
|
|
194
194
|
headers=_headers,
|
195
195
|
params=_params,
|
196
196
|
)
|
197
|
-
_request = _convert_request(_request)
|
198
197
|
_request.url = self._client.format_url(_request.url)
|
199
198
|
|
199
|
+
_decompress = kwargs.pop("decompress", True)
|
200
200
|
_stream = True
|
201
201
|
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
|
202
202
|
_request, stream=_stream, **kwargs
|
@@ -205,6 +205,10 @@ class BlobOperations: # pylint: disable=too-many-public-methods
|
|
205
205
|
response = pipeline_response.http_response
|
206
206
|
|
207
207
|
if response.status_code not in [200, 206]:
|
208
|
+
try:
|
209
|
+
await response.read() # Load the body in memory and close the socket
|
210
|
+
except (StreamConsumedError, StreamClosedError):
|
211
|
+
pass
|
208
212
|
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
209
213
|
error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response)
|
210
214
|
raise HttpResponseError(response=response, model=error)
|
@@ -289,8 +293,6 @@ class BlobOperations: # pylint: disable=too-many-public-methods
|
|
289
293
|
)
|
290
294
|
response_headers["x-ms-legal-hold"] = self._deserialize("bool", response.headers.get("x-ms-legal-hold"))
|
291
295
|
|
292
|
-
deserialized = response.stream_download(self._client._pipeline)
|
293
|
-
|
294
296
|
if response.status_code == 206:
|
295
297
|
response_headers["Last-Modified"] = self._deserialize("rfc-1123", response.headers.get("Last-Modified"))
|
296
298
|
response_headers["x-ms-creation-time"] = self._deserialize(
|
@@ -373,7 +375,7 @@ class BlobOperations: # pylint: disable=too-many-public-methods
|
|
373
375
|
)
|
374
376
|
response_headers["x-ms-legal-hold"] = self._deserialize("bool", response.headers.get("x-ms-legal-hold"))
|
375
377
|
|
376
|
-
|
378
|
+
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
|
377
379
|
|
378
380
|
if cls:
|
379
381
|
return cls(pipeline_response, deserialized, response_headers) # type: ignore
|
@@ -478,7 +480,6 @@ class BlobOperations: # pylint: disable=too-many-public-methods
|
|
478
480
|
headers=_headers,
|
479
481
|
params=_params,
|
480
482
|
)
|
481
|
-
_request = _convert_request(_request)
|
482
483
|
_request.url = self._client.format_url(_request.url)
|
483
484
|
|
484
485
|
_stream = False
|
@@ -691,7 +692,6 @@ class BlobOperations: # pylint: disable=too-many-public-methods
|
|
691
692
|
headers=_headers,
|
692
693
|
params=_params,
|
693
694
|
)
|
694
|
-
_request = _convert_request(_request)
|
695
695
|
_request.url = self._client.format_url(_request.url)
|
696
696
|
|
697
697
|
_stream = False
|
@@ -759,7 +759,6 @@ class BlobOperations: # pylint: disable=too-many-public-methods
|
|
759
759
|
headers=_headers,
|
760
760
|
params=_params,
|
761
761
|
)
|
762
|
-
_request = _convert_request(_request)
|
763
762
|
_request.url = self._client.format_url(_request.url)
|
764
763
|
|
765
764
|
_stream = False
|
@@ -839,7 +838,6 @@ class BlobOperations: # pylint: disable=too-many-public-methods
|
|
839
838
|
headers=_headers,
|
840
839
|
params=_params,
|
841
840
|
)
|
842
|
-
_request = _convert_request(_request)
|
843
841
|
_request.url = self._client.format_url(_request.url)
|
844
842
|
|
845
843
|
_stream = False
|
@@ -961,7 +959,6 @@ class BlobOperations: # pylint: disable=too-many-public-methods
|
|
961
959
|
headers=_headers,
|
962
960
|
params=_params,
|
963
961
|
)
|
964
|
-
_request = _convert_request(_request)
|
965
962
|
_request.url = self._client.format_url(_request.url)
|
966
963
|
|
967
964
|
_stream = False
|
@@ -1055,7 +1052,6 @@ class BlobOperations: # pylint: disable=too-many-public-methods
|
|
1055
1052
|
headers=_headers,
|
1056
1053
|
params=_params,
|
1057
1054
|
)
|
1058
|
-
_request = _convert_request(_request)
|
1059
1055
|
_request.url = self._client.format_url(_request.url)
|
1060
1056
|
|
1061
1057
|
_stream = False
|
@@ -1129,7 +1125,6 @@ class BlobOperations: # pylint: disable=too-many-public-methods
|
|
1129
1125
|
headers=_headers,
|
1130
1126
|
params=_params,
|
1131
1127
|
)
|
1132
|
-
_request = _convert_request(_request)
|
1133
1128
|
_request.url = self._client.format_url(_request.url)
|
1134
1129
|
|
1135
1130
|
_stream = False
|
@@ -1200,7 +1195,6 @@ class BlobOperations: # pylint: disable=too-many-public-methods
|
|
1200
1195
|
headers=_headers,
|
1201
1196
|
params=_params,
|
1202
1197
|
)
|
1203
|
-
_request = _convert_request(_request)
|
1204
1198
|
_request.url = self._client.format_url(_request.url)
|
1205
1199
|
|
1206
1200
|
_stream = False
|
@@ -1330,7 +1324,6 @@ class BlobOperations: # pylint: disable=too-many-public-methods
|
|
1330
1324
|
headers=_headers,
|
1331
1325
|
params=_params,
|
1332
1326
|
)
|
1333
|
-
_request = _convert_request(_request)
|
1334
1327
|
_request.url = self._client.format_url(_request.url)
|
1335
1328
|
|
1336
1329
|
_stream = False
|
@@ -1448,7 +1441,6 @@ class BlobOperations: # pylint: disable=too-many-public-methods
|
|
1448
1441
|
headers=_headers,
|
1449
1442
|
params=_params,
|
1450
1443
|
)
|
1451
|
-
_request = _convert_request(_request)
|
1452
1444
|
_request.url = self._client.format_url(_request.url)
|
1453
1445
|
|
1454
1446
|
_stream = False
|
@@ -1549,7 +1541,6 @@ class BlobOperations: # pylint: disable=too-many-public-methods
|
|
1549
1541
|
headers=_headers,
|
1550
1542
|
params=_params,
|
1551
1543
|
)
|
1552
|
-
_request = _convert_request(_request)
|
1553
1544
|
_request.url = self._client.format_url(_request.url)
|
1554
1545
|
|
1555
1546
|
_stream = False
|
@@ -1649,7 +1640,6 @@ class BlobOperations: # pylint: disable=too-many-public-methods
|
|
1649
1640
|
headers=_headers,
|
1650
1641
|
params=_params,
|
1651
1642
|
)
|
1652
|
-
_request = _convert_request(_request)
|
1653
1643
|
_request.url = self._client.format_url(_request.url)
|
1654
1644
|
|
1655
1645
|
_stream = False
|
@@ -1756,7 +1746,6 @@ class BlobOperations: # pylint: disable=too-many-public-methods
|
|
1756
1746
|
headers=_headers,
|
1757
1747
|
params=_params,
|
1758
1748
|
)
|
1759
|
-
_request = _convert_request(_request)
|
1760
1749
|
_request.url = self._client.format_url(_request.url)
|
1761
1750
|
|
1762
1751
|
_stream = False
|
@@ -1863,7 +1852,6 @@ class BlobOperations: # pylint: disable=too-many-public-methods
|
|
1863
1852
|
headers=_headers,
|
1864
1853
|
params=_params,
|
1865
1854
|
)
|
1866
|
-
_request = _convert_request(_request)
|
1867
1855
|
_request.url = self._client.format_url(_request.url)
|
1868
1856
|
|
1869
1857
|
_stream = False
|
@@ -1994,7 +1982,6 @@ class BlobOperations: # pylint: disable=too-many-public-methods
|
|
1994
1982
|
headers=_headers,
|
1995
1983
|
params=_params,
|
1996
1984
|
)
|
1997
|
-
_request = _convert_request(_request)
|
1998
1985
|
_request.url = self._client.format_url(_request.url)
|
1999
1986
|
|
2000
1987
|
_stream = False
|
@@ -2169,7 +2156,6 @@ class BlobOperations: # pylint: disable=too-many-public-methods
|
|
2169
2156
|
headers=_headers,
|
2170
2157
|
params=_params,
|
2171
2158
|
)
|
2172
|
-
_request = _convert_request(_request)
|
2173
2159
|
_request.url = self._client.format_url(_request.url)
|
2174
2160
|
|
2175
2161
|
_stream = False
|
@@ -2357,7 +2343,6 @@ class BlobOperations: # pylint: disable=too-many-public-methods
|
|
2357
2343
|
headers=_headers,
|
2358
2344
|
params=_params,
|
2359
2345
|
)
|
2360
|
-
_request = _convert_request(_request)
|
2361
2346
|
_request.url = self._client.format_url(_request.url)
|
2362
2347
|
|
2363
2348
|
_stream = False
|
@@ -2458,7 +2443,6 @@ class BlobOperations: # pylint: disable=too-many-public-methods
|
|
2458
2443
|
headers=_headers,
|
2459
2444
|
params=_params,
|
2460
2445
|
)
|
2461
|
-
_request = _convert_request(_request)
|
2462
2446
|
_request.url = self._client.format_url(_request.url)
|
2463
2447
|
|
2464
2448
|
_stream = False
|
@@ -2573,7 +2557,6 @@ class BlobOperations: # pylint: disable=too-many-public-methods
|
|
2573
2557
|
headers=_headers,
|
2574
2558
|
params=_params,
|
2575
2559
|
)
|
2576
|
-
_request = _convert_request(_request)
|
2577
2560
|
_request.url = self._client.format_url(_request.url)
|
2578
2561
|
|
2579
2562
|
_stream = False
|
@@ -2589,19 +2572,11 @@ class BlobOperations: # pylint: disable=too-many-public-methods
|
|
2589
2572
|
raise HttpResponseError(response=response, model=error)
|
2590
2573
|
|
2591
2574
|
response_headers = {}
|
2592
|
-
|
2593
|
-
|
2594
|
-
|
2595
|
-
|
2596
|
-
|
2597
|
-
response_headers["x-ms-version"] = self._deserialize("str", response.headers.get("x-ms-version"))
|
2598
|
-
|
2599
|
-
if response.status_code == 202:
|
2600
|
-
response_headers["x-ms-client-request-id"] = self._deserialize(
|
2601
|
-
"str", response.headers.get("x-ms-client-request-id")
|
2602
|
-
)
|
2603
|
-
response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id"))
|
2604
|
-
response_headers["x-ms-version"] = self._deserialize("str", response.headers.get("x-ms-version"))
|
2575
|
+
response_headers["x-ms-client-request-id"] = self._deserialize(
|
2576
|
+
"str", response.headers.get("x-ms-client-request-id")
|
2577
|
+
)
|
2578
|
+
response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id"))
|
2579
|
+
response_headers["x-ms-version"] = self._deserialize("str", response.headers.get("x-ms-version"))
|
2605
2580
|
|
2606
2581
|
if cls:
|
2607
2582
|
return cls(pipeline_response, None, response_headers) # type: ignore
|
@@ -2650,7 +2625,6 @@ class BlobOperations: # pylint: disable=too-many-public-methods
|
|
2650
2625
|
headers=_headers,
|
2651
2626
|
params=_params,
|
2652
2627
|
)
|
2653
|
-
_request = _convert_request(_request)
|
2654
2628
|
_request.url = self._client.format_url(_request.url)
|
2655
2629
|
|
2656
2630
|
_stream = False
|
@@ -2783,9 +2757,9 @@ class BlobOperations: # pylint: disable=too-many-public-methods
|
|
2783
2757
|
headers=_headers,
|
2784
2758
|
params=_params,
|
2785
2759
|
)
|
2786
|
-
_request = _convert_request(_request)
|
2787
2760
|
_request.url = self._client.format_url(_request.url)
|
2788
2761
|
|
2762
|
+
_decompress = kwargs.pop("decompress", True)
|
2789
2763
|
_stream = True
|
2790
2764
|
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
|
2791
2765
|
_request, stream=_stream, **kwargs
|
@@ -2794,6 +2768,10 @@ class BlobOperations: # pylint: disable=too-many-public-methods
|
|
2794
2768
|
response = pipeline_response.http_response
|
2795
2769
|
|
2796
2770
|
if response.status_code not in [200, 206]:
|
2771
|
+
try:
|
2772
|
+
await response.read() # Load the body in memory and close the socket
|
2773
|
+
except (StreamConsumedError, StreamClosedError):
|
2774
|
+
pass
|
2797
2775
|
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
2798
2776
|
error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response)
|
2799
2777
|
raise HttpResponseError(response=response, model=error)
|
@@ -2857,8 +2835,6 @@ class BlobOperations: # pylint: disable=too-many-public-methods
|
|
2857
2835
|
"bytearray", response.headers.get("x-ms-blob-content-md5")
|
2858
2836
|
)
|
2859
2837
|
|
2860
|
-
deserialized = response.stream_download(self._client._pipeline)
|
2861
|
-
|
2862
2838
|
if response.status_code == 206:
|
2863
2839
|
response_headers["Last-Modified"] = self._deserialize("rfc-1123", response.headers.get("Last-Modified"))
|
2864
2840
|
response_headers["x-ms-meta"] = self._deserialize("{str}", response.headers.get("x-ms-meta"))
|
@@ -2920,7 +2896,7 @@ class BlobOperations: # pylint: disable=too-many-public-methods
|
|
2920
2896
|
"bytearray", response.headers.get("x-ms-blob-content-md5")
|
2921
2897
|
)
|
2922
2898
|
|
2923
|
-
|
2899
|
+
deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
|
2924
2900
|
|
2925
2901
|
if cls:
|
2926
2902
|
return cls(pipeline_response, deserialized, response_headers) # type: ignore
|
@@ -3001,7 +2977,6 @@ class BlobOperations: # pylint: disable=too-many-public-methods
|
|
3001
2977
|
headers=_headers,
|
3002
2978
|
params=_params,
|
3003
2979
|
)
|
3004
|
-
_request = _convert_request(_request)
|
3005
2980
|
_request.url = self._client.format_url(_request.url)
|
3006
2981
|
|
3007
2982
|
_stream = False
|
@@ -3024,7 +2999,7 @@ class BlobOperations: # pylint: disable=too-many-public-methods
|
|
3024
2999
|
response_headers["x-ms-version"] = self._deserialize("str", response.headers.get("x-ms-version"))
|
3025
3000
|
response_headers["Date"] = self._deserialize("rfc-1123", response.headers.get("Date"))
|
3026
3001
|
|
3027
|
-
deserialized = self._deserialize("BlobTags", pipeline_response)
|
3002
|
+
deserialized = self._deserialize("BlobTags", pipeline_response.http_response)
|
3028
3003
|
|
3029
3004
|
if cls:
|
3030
3005
|
return cls(pipeline_response, deserialized, response_headers) # type: ignore
|
@@ -3117,7 +3092,6 @@ class BlobOperations: # pylint: disable=too-many-public-methods
|
|
3117
3092
|
headers=_headers,
|
3118
3093
|
params=_params,
|
3119
3094
|
)
|
3120
|
-
_request = _convert_request(_request)
|
3121
3095
|
_request.url = self._client.format_url(_request.url)
|
3122
3096
|
|
3123
3097
|
_stream = False
|
@@ -19,13 +19,11 @@ from azure.core.exceptions import (
|
|
19
19
|
map_error,
|
20
20
|
)
|
21
21
|
from azure.core.pipeline import PipelineResponse
|
22
|
-
from azure.core.
|
23
|
-
from azure.core.rest import HttpRequest
|
22
|
+
from azure.core.rest import AsyncHttpResponse, HttpRequest
|
24
23
|
from azure.core.tracing.decorator_async import distributed_trace_async
|
25
24
|
from azure.core.utils import case_insensitive_dict
|
26
25
|
|
27
26
|
from ... import models as _models
|
28
|
-
from ..._vendor import _convert_request
|
29
27
|
from ...operations._block_blob_operations import (
|
30
28
|
build_commit_block_list_request,
|
31
29
|
build_get_block_list_request,
|
@@ -236,7 +234,6 @@ class BlockBlobOperations:
|
|
236
234
|
headers=_headers,
|
237
235
|
params=_params,
|
238
236
|
)
|
239
|
-
_request = _convert_request(_request)
|
240
237
|
_request.url = self._client.format_url(_request.url)
|
241
238
|
|
242
239
|
_stream = False
|
@@ -471,7 +468,6 @@ class BlockBlobOperations:
|
|
471
468
|
headers=_headers,
|
472
469
|
params=_params,
|
473
470
|
)
|
474
|
-
_request = _convert_request(_request)
|
475
471
|
_request.url = self._client.format_url(_request.url)
|
476
472
|
|
477
473
|
_stream = False
|
@@ -610,7 +606,6 @@ class BlockBlobOperations:
|
|
610
606
|
headers=_headers,
|
611
607
|
params=_params,
|
612
608
|
)
|
613
|
-
_request = _convert_request(_request)
|
614
609
|
_request.url = self._client.format_url(_request.url)
|
615
610
|
|
616
611
|
_stream = False
|
@@ -773,7 +768,6 @@ class BlockBlobOperations:
|
|
773
768
|
headers=_headers,
|
774
769
|
params=_params,
|
775
770
|
)
|
776
|
-
_request = _convert_request(_request)
|
777
771
|
_request.url = self._client.format_url(_request.url)
|
778
772
|
|
779
773
|
_stream = False
|
@@ -984,7 +978,6 @@ class BlockBlobOperations:
|
|
984
978
|
headers=_headers,
|
985
979
|
params=_params,
|
986
980
|
)
|
987
|
-
_request = _convert_request(_request)
|
988
981
|
_request.url = self._client.format_url(_request.url)
|
989
982
|
|
990
983
|
_stream = False
|
@@ -1101,7 +1094,6 @@ class BlockBlobOperations:
|
|
1101
1094
|
headers=_headers,
|
1102
1095
|
params=_params,
|
1103
1096
|
)
|
1104
|
-
_request = _convert_request(_request)
|
1105
1097
|
_request.url = self._client.format_url(_request.url)
|
1106
1098
|
|
1107
1099
|
_stream = False
|
@@ -1130,7 +1122,7 @@ class BlockBlobOperations:
|
|
1130
1122
|
response_headers["x-ms-version"] = self._deserialize("str", response.headers.get("x-ms-version"))
|
1131
1123
|
response_headers["Date"] = self._deserialize("rfc-1123", response.headers.get("Date"))
|
1132
1124
|
|
1133
|
-
deserialized = self._deserialize("BlockList", pipeline_response)
|
1125
|
+
deserialized = self._deserialize("BlockList", pipeline_response.http_response)
|
1134
1126
|
|
1135
1127
|
if cls:
|
1136
1128
|
return cls(pipeline_response, deserialized, response_headers) # type: ignore
|