azure-storage-blob 12.23.0b1__py3-none-any.whl → 12.23.1__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.
Files changed (30) hide show
  1. azure/storage/blob/_container_client.py +6 -0
  2. azure/storage/blob/_container_client_helpers.py +7 -2
  3. azure/storage/blob/_encryption.py +13 -10
  4. azure/storage/blob/_generated/_azure_blob_storage.py +2 -1
  5. azure/storage/blob/_generated/_serialization.py +2 -0
  6. azure/storage/blob/_generated/aio/_azure_blob_storage.py +2 -1
  7. azure/storage/blob/_generated/aio/operations/_append_blob_operations.py +1 -7
  8. azure/storage/blob/_generated/aio/operations/_blob_operations.py +21 -47
  9. azure/storage/blob/_generated/aio/operations/_block_blob_operations.py +2 -10
  10. azure/storage/blob/_generated/aio/operations/_container_operations.py +13 -26
  11. azure/storage/blob/_generated/aio/operations/_page_blob_operations.py +3 -14
  12. azure/storage/blob/_generated/aio/operations/_service_operations.py +14 -17
  13. azure/storage/blob/_generated/operations/_append_blob_operations.py +1 -7
  14. azure/storage/blob/_generated/operations/_blob_operations.py +21 -47
  15. azure/storage/blob/_generated/operations/_block_blob_operations.py +2 -10
  16. azure/storage/blob/_generated/operations/_container_operations.py +13 -26
  17. azure/storage/blob/_generated/operations/_page_blob_operations.py +3 -14
  18. azure/storage/blob/_generated/operations/_service_operations.py +14 -17
  19. azure/storage/blob/_shared/base_client.py +2 -0
  20. azure/storage/blob/_shared/policies.py +8 -9
  21. azure/storage/blob/_shared/policies_async.py +18 -5
  22. azure/storage/blob/_version.py +1 -1
  23. azure/storage/blob/aio/_container_client_async.py +6 -0
  24. azure/storage/blob/aio/_download_async.py +94 -71
  25. {azure_storage_blob-12.23.0b1.dist-info → azure_storage_blob-12.23.1.dist-info}/METADATA +2 -2
  26. {azure_storage_blob-12.23.0b1.dist-info → azure_storage_blob-12.23.1.dist-info}/RECORD +29 -30
  27. {azure_storage_blob-12.23.0b1.dist-info → azure_storage_blob-12.23.1.dist-info}/WHEEL +1 -1
  28. azure/storage/blob/_generated/_vendor.py +0 -16
  29. {azure_storage_blob-12.23.0b1.dist-info → azure_storage_blob-12.23.1.dist-info}/LICENSE +0 -0
  30. {azure_storage_blob-12.23.0b1.dist-info → azure_storage_blob-12.23.1.dist-info}/top_level.txt +0 -0
@@ -16,17 +16,17 @@ 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.pipeline.transport import HttpResponse
23
- from azure.core.rest import HttpRequest
24
+ from azure.core.rest import HttpRequest, HttpResponse
24
25
  from azure.core.tracing.decorator import distributed_trace
25
26
  from azure.core.utils import case_insensitive_dict
26
27
 
27
28
  from .. import models as _models
28
29
  from .._serialization import Serializer
29
- from .._vendor import _convert_request
30
30
 
31
31
  if sys.version_info >= (3, 9):
32
32
  from collections.abc import MutableMapping
@@ -1601,9 +1601,9 @@ class BlobOperations: # pylint: disable=too-many-public-methods
1601
1601
  headers=_headers,
1602
1602
  params=_params,
1603
1603
  )
1604
- _request = _convert_request(_request)
1605
1604
  _request.url = self._client.format_url(_request.url)
1606
1605
 
1606
+ _decompress = kwargs.pop("decompress", True)
1607
1607
  _stream = True
1608
1608
  pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
1609
1609
  _request, stream=_stream, **kwargs
@@ -1612,6 +1612,10 @@ class BlobOperations: # pylint: disable=too-many-public-methods
1612
1612
  response = pipeline_response.http_response
1613
1613
 
1614
1614
  if response.status_code not in [200, 206]:
1615
+ try:
1616
+ response.read() # Load the body in memory and close the socket
1617
+ except (StreamConsumedError, StreamClosedError):
1618
+ pass
1615
1619
  map_error(status_code=response.status_code, response=response, error_map=error_map)
1616
1620
  error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response)
1617
1621
  raise HttpResponseError(response=response, model=error)
@@ -1696,8 +1700,6 @@ class BlobOperations: # pylint: disable=too-many-public-methods
1696
1700
  )
1697
1701
  response_headers["x-ms-legal-hold"] = self._deserialize("bool", response.headers.get("x-ms-legal-hold"))
1698
1702
 
1699
- deserialized = response.stream_download(self._client._pipeline)
1700
-
1701
1703
  if response.status_code == 206:
1702
1704
  response_headers["Last-Modified"] = self._deserialize("rfc-1123", response.headers.get("Last-Modified"))
1703
1705
  response_headers["x-ms-creation-time"] = self._deserialize(
@@ -1780,7 +1782,7 @@ class BlobOperations: # pylint: disable=too-many-public-methods
1780
1782
  )
1781
1783
  response_headers["x-ms-legal-hold"] = self._deserialize("bool", response.headers.get("x-ms-legal-hold"))
1782
1784
 
1783
- deserialized = response.stream_download(self._client._pipeline)
1785
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
1784
1786
 
1785
1787
  if cls:
1786
1788
  return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -1885,7 +1887,6 @@ class BlobOperations: # pylint: disable=too-many-public-methods
1885
1887
  headers=_headers,
1886
1888
  params=_params,
1887
1889
  )
1888
- _request = _convert_request(_request)
1889
1890
  _request.url = self._client.format_url(_request.url)
1890
1891
 
1891
1892
  _stream = False
@@ -2098,7 +2099,6 @@ class BlobOperations: # pylint: disable=too-many-public-methods
2098
2099
  headers=_headers,
2099
2100
  params=_params,
2100
2101
  )
2101
- _request = _convert_request(_request)
2102
2102
  _request.url = self._client.format_url(_request.url)
2103
2103
 
2104
2104
  _stream = False
@@ -2166,7 +2166,6 @@ class BlobOperations: # pylint: disable=too-many-public-methods
2166
2166
  headers=_headers,
2167
2167
  params=_params,
2168
2168
  )
2169
- _request = _convert_request(_request)
2170
2169
  _request.url = self._client.format_url(_request.url)
2171
2170
 
2172
2171
  _stream = False
@@ -2246,7 +2245,6 @@ class BlobOperations: # pylint: disable=too-many-public-methods
2246
2245
  headers=_headers,
2247
2246
  params=_params,
2248
2247
  )
2249
- _request = _convert_request(_request)
2250
2248
  _request.url = self._client.format_url(_request.url)
2251
2249
 
2252
2250
  _stream = False
@@ -2368,7 +2366,6 @@ class BlobOperations: # pylint: disable=too-many-public-methods
2368
2366
  headers=_headers,
2369
2367
  params=_params,
2370
2368
  )
2371
- _request = _convert_request(_request)
2372
2369
  _request.url = self._client.format_url(_request.url)
2373
2370
 
2374
2371
  _stream = False
@@ -2462,7 +2459,6 @@ class BlobOperations: # pylint: disable=too-many-public-methods
2462
2459
  headers=_headers,
2463
2460
  params=_params,
2464
2461
  )
2465
- _request = _convert_request(_request)
2466
2462
  _request.url = self._client.format_url(_request.url)
2467
2463
 
2468
2464
  _stream = False
@@ -2536,7 +2532,6 @@ class BlobOperations: # pylint: disable=too-many-public-methods
2536
2532
  headers=_headers,
2537
2533
  params=_params,
2538
2534
  )
2539
- _request = _convert_request(_request)
2540
2535
  _request.url = self._client.format_url(_request.url)
2541
2536
 
2542
2537
  _stream = False
@@ -2607,7 +2602,6 @@ class BlobOperations: # pylint: disable=too-many-public-methods
2607
2602
  headers=_headers,
2608
2603
  params=_params,
2609
2604
  )
2610
- _request = _convert_request(_request)
2611
2605
  _request.url = self._client.format_url(_request.url)
2612
2606
 
2613
2607
  _stream = False
@@ -2737,7 +2731,6 @@ class BlobOperations: # pylint: disable=too-many-public-methods
2737
2731
  headers=_headers,
2738
2732
  params=_params,
2739
2733
  )
2740
- _request = _convert_request(_request)
2741
2734
  _request.url = self._client.format_url(_request.url)
2742
2735
 
2743
2736
  _stream = False
@@ -2855,7 +2848,6 @@ class BlobOperations: # pylint: disable=too-many-public-methods
2855
2848
  headers=_headers,
2856
2849
  params=_params,
2857
2850
  )
2858
- _request = _convert_request(_request)
2859
2851
  _request.url = self._client.format_url(_request.url)
2860
2852
 
2861
2853
  _stream = False
@@ -2956,7 +2948,6 @@ class BlobOperations: # pylint: disable=too-many-public-methods
2956
2948
  headers=_headers,
2957
2949
  params=_params,
2958
2950
  )
2959
- _request = _convert_request(_request)
2960
2951
  _request.url = self._client.format_url(_request.url)
2961
2952
 
2962
2953
  _stream = False
@@ -3056,7 +3047,6 @@ class BlobOperations: # pylint: disable=too-many-public-methods
3056
3047
  headers=_headers,
3057
3048
  params=_params,
3058
3049
  )
3059
- _request = _convert_request(_request)
3060
3050
  _request.url = self._client.format_url(_request.url)
3061
3051
 
3062
3052
  _stream = False
@@ -3163,7 +3153,6 @@ class BlobOperations: # pylint: disable=too-many-public-methods
3163
3153
  headers=_headers,
3164
3154
  params=_params,
3165
3155
  )
3166
- _request = _convert_request(_request)
3167
3156
  _request.url = self._client.format_url(_request.url)
3168
3157
 
3169
3158
  _stream = False
@@ -3270,7 +3259,6 @@ class BlobOperations: # pylint: disable=too-many-public-methods
3270
3259
  headers=_headers,
3271
3260
  params=_params,
3272
3261
  )
3273
- _request = _convert_request(_request)
3274
3262
  _request.url = self._client.format_url(_request.url)
3275
3263
 
3276
3264
  _stream = False
@@ -3401,7 +3389,6 @@ class BlobOperations: # pylint: disable=too-many-public-methods
3401
3389
  headers=_headers,
3402
3390
  params=_params,
3403
3391
  )
3404
- _request = _convert_request(_request)
3405
3392
  _request.url = self._client.format_url(_request.url)
3406
3393
 
3407
3394
  _stream = False
@@ -3576,7 +3563,6 @@ class BlobOperations: # pylint: disable=too-many-public-methods
3576
3563
  headers=_headers,
3577
3564
  params=_params,
3578
3565
  )
3579
- _request = _convert_request(_request)
3580
3566
  _request.url = self._client.format_url(_request.url)
3581
3567
 
3582
3568
  _stream = False
@@ -3764,7 +3750,6 @@ class BlobOperations: # pylint: disable=too-many-public-methods
3764
3750
  headers=_headers,
3765
3751
  params=_params,
3766
3752
  )
3767
- _request = _convert_request(_request)
3768
3753
  _request.url = self._client.format_url(_request.url)
3769
3754
 
3770
3755
  _stream = False
@@ -3865,7 +3850,6 @@ class BlobOperations: # pylint: disable=too-many-public-methods
3865
3850
  headers=_headers,
3866
3851
  params=_params,
3867
3852
  )
3868
- _request = _convert_request(_request)
3869
3853
  _request.url = self._client.format_url(_request.url)
3870
3854
 
3871
3855
  _stream = False
@@ -3980,7 +3964,6 @@ class BlobOperations: # pylint: disable=too-many-public-methods
3980
3964
  headers=_headers,
3981
3965
  params=_params,
3982
3966
  )
3983
- _request = _convert_request(_request)
3984
3967
  _request.url = self._client.format_url(_request.url)
3985
3968
 
3986
3969
  _stream = False
@@ -3996,19 +3979,11 @@ class BlobOperations: # pylint: disable=too-many-public-methods
3996
3979
  raise HttpResponseError(response=response, model=error)
3997
3980
 
3998
3981
  response_headers = {}
3999
- if response.status_code == 200:
4000
- response_headers["x-ms-client-request-id"] = self._deserialize(
4001
- "str", response.headers.get("x-ms-client-request-id")
4002
- )
4003
- response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id"))
4004
- response_headers["x-ms-version"] = self._deserialize("str", response.headers.get("x-ms-version"))
4005
-
4006
- if response.status_code == 202:
4007
- response_headers["x-ms-client-request-id"] = self._deserialize(
4008
- "str", response.headers.get("x-ms-client-request-id")
4009
- )
4010
- response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id"))
4011
- response_headers["x-ms-version"] = self._deserialize("str", response.headers.get("x-ms-version"))
3982
+ response_headers["x-ms-client-request-id"] = self._deserialize(
3983
+ "str", response.headers.get("x-ms-client-request-id")
3984
+ )
3985
+ response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id"))
3986
+ response_headers["x-ms-version"] = self._deserialize("str", response.headers.get("x-ms-version"))
4012
3987
 
4013
3988
  if cls:
4014
3989
  return cls(pipeline_response, None, response_headers) # type: ignore
@@ -4057,7 +4032,6 @@ class BlobOperations: # pylint: disable=too-many-public-methods
4057
4032
  headers=_headers,
4058
4033
  params=_params,
4059
4034
  )
4060
- _request = _convert_request(_request)
4061
4035
  _request.url = self._client.format_url(_request.url)
4062
4036
 
4063
4037
  _stream = False
@@ -4190,9 +4164,9 @@ class BlobOperations: # pylint: disable=too-many-public-methods
4190
4164
  headers=_headers,
4191
4165
  params=_params,
4192
4166
  )
4193
- _request = _convert_request(_request)
4194
4167
  _request.url = self._client.format_url(_request.url)
4195
4168
 
4169
+ _decompress = kwargs.pop("decompress", True)
4196
4170
  _stream = True
4197
4171
  pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
4198
4172
  _request, stream=_stream, **kwargs
@@ -4201,6 +4175,10 @@ class BlobOperations: # pylint: disable=too-many-public-methods
4201
4175
  response = pipeline_response.http_response
4202
4176
 
4203
4177
  if response.status_code not in [200, 206]:
4178
+ try:
4179
+ response.read() # Load the body in memory and close the socket
4180
+ except (StreamConsumedError, StreamClosedError):
4181
+ pass
4204
4182
  map_error(status_code=response.status_code, response=response, error_map=error_map)
4205
4183
  error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response)
4206
4184
  raise HttpResponseError(response=response, model=error)
@@ -4264,8 +4242,6 @@ class BlobOperations: # pylint: disable=too-many-public-methods
4264
4242
  "bytearray", response.headers.get("x-ms-blob-content-md5")
4265
4243
  )
4266
4244
 
4267
- deserialized = response.stream_download(self._client._pipeline)
4268
-
4269
4245
  if response.status_code == 206:
4270
4246
  response_headers["Last-Modified"] = self._deserialize("rfc-1123", response.headers.get("Last-Modified"))
4271
4247
  response_headers["x-ms-meta"] = self._deserialize("{str}", response.headers.get("x-ms-meta"))
@@ -4327,7 +4303,7 @@ class BlobOperations: # pylint: disable=too-many-public-methods
4327
4303
  "bytearray", response.headers.get("x-ms-blob-content-md5")
4328
4304
  )
4329
4305
 
4330
- deserialized = response.stream_download(self._client._pipeline)
4306
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
4331
4307
 
4332
4308
  if cls:
4333
4309
  return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -4408,7 +4384,6 @@ class BlobOperations: # pylint: disable=too-many-public-methods
4408
4384
  headers=_headers,
4409
4385
  params=_params,
4410
4386
  )
4411
- _request = _convert_request(_request)
4412
4387
  _request.url = self._client.format_url(_request.url)
4413
4388
 
4414
4389
  _stream = False
@@ -4431,7 +4406,7 @@ class BlobOperations: # pylint: disable=too-many-public-methods
4431
4406
  response_headers["x-ms-version"] = self._deserialize("str", response.headers.get("x-ms-version"))
4432
4407
  response_headers["Date"] = self._deserialize("rfc-1123", response.headers.get("Date"))
4433
4408
 
4434
- deserialized = self._deserialize("BlobTags", pipeline_response)
4409
+ deserialized = self._deserialize("BlobTags", pipeline_response.http_response)
4435
4410
 
4436
4411
  if cls:
4437
4412
  return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -4524,7 +4499,6 @@ class BlobOperations: # pylint: disable=too-many-public-methods
4524
4499
  headers=_headers,
4525
4500
  params=_params,
4526
4501
  )
4527
- _request = _convert_request(_request)
4528
4502
  _request.url = self._client.format_url(_request.url)
4529
4503
 
4530
4504
  _stream = False
@@ -19,14 +19,12 @@ from azure.core.exceptions import (
19
19
  map_error,
20
20
  )
21
21
  from azure.core.pipeline import PipelineResponse
22
- from azure.core.pipeline.transport import HttpResponse
23
- from azure.core.rest import HttpRequest
22
+ from azure.core.rest import HttpRequest, HttpResponse
24
23
  from azure.core.tracing.decorator import distributed_trace
25
24
  from azure.core.utils import case_insensitive_dict
26
25
 
27
26
  from .. import models as _models
28
27
  from .._serialization import Serializer
29
- from .._vendor import _convert_request
30
28
 
31
29
  if sys.version_info >= (3, 9):
32
30
  from collections.abc import MutableMapping
@@ -844,7 +842,6 @@ class BlockBlobOperations:
844
842
  headers=_headers,
845
843
  params=_params,
846
844
  )
847
- _request = _convert_request(_request)
848
845
  _request.url = self._client.format_url(_request.url)
849
846
 
850
847
  _stream = False
@@ -1079,7 +1076,6 @@ class BlockBlobOperations:
1079
1076
  headers=_headers,
1080
1077
  params=_params,
1081
1078
  )
1082
- _request = _convert_request(_request)
1083
1079
  _request.url = self._client.format_url(_request.url)
1084
1080
 
1085
1081
  _stream = False
@@ -1218,7 +1214,6 @@ class BlockBlobOperations:
1218
1214
  headers=_headers,
1219
1215
  params=_params,
1220
1216
  )
1221
- _request = _convert_request(_request)
1222
1217
  _request.url = self._client.format_url(_request.url)
1223
1218
 
1224
1219
  _stream = False
@@ -1381,7 +1376,6 @@ class BlockBlobOperations:
1381
1376
  headers=_headers,
1382
1377
  params=_params,
1383
1378
  )
1384
- _request = _convert_request(_request)
1385
1379
  _request.url = self._client.format_url(_request.url)
1386
1380
 
1387
1381
  _stream = False
@@ -1592,7 +1586,6 @@ class BlockBlobOperations:
1592
1586
  headers=_headers,
1593
1587
  params=_params,
1594
1588
  )
1595
- _request = _convert_request(_request)
1596
1589
  _request.url = self._client.format_url(_request.url)
1597
1590
 
1598
1591
  _stream = False
@@ -1709,7 +1702,6 @@ class BlockBlobOperations:
1709
1702
  headers=_headers,
1710
1703
  params=_params,
1711
1704
  )
1712
- _request = _convert_request(_request)
1713
1705
  _request.url = self._client.format_url(_request.url)
1714
1706
 
1715
1707
  _stream = False
@@ -1738,7 +1730,7 @@ class BlockBlobOperations:
1738
1730
  response_headers["x-ms-version"] = self._deserialize("str", response.headers.get("x-ms-version"))
1739
1731
  response_headers["Date"] = self._deserialize("rfc-1123", response.headers.get("Date"))
1740
1732
 
1741
- deserialized = self._deserialize("BlockList", pipeline_response)
1733
+ deserialized = self._deserialize("BlockList", pipeline_response.http_response)
1742
1734
 
1743
1735
  if cls:
1744
1736
  return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -16,17 +16,17 @@ 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.pipeline.transport import HttpResponse
23
- from azure.core.rest import HttpRequest
24
+ from azure.core.rest import HttpRequest, HttpResponse
24
25
  from azure.core.tracing.decorator import distributed_trace
25
26
  from azure.core.utils import case_insensitive_dict
26
27
 
27
28
  from .. import models as _models
28
29
  from .._serialization import Serializer
29
- from .._vendor import _convert_request
30
30
 
31
31
  if sys.version_info >= (3, 9):
32
32
  from collections.abc import MutableMapping
@@ -976,7 +976,6 @@ class ContainerOperations:
976
976
  headers=_headers,
977
977
  params=_params,
978
978
  )
979
- _request = _convert_request(_request)
980
979
  _request.url = self._client.format_url(_request.url)
981
980
 
982
981
  _stream = False
@@ -1058,7 +1057,6 @@ class ContainerOperations:
1058
1057
  headers=_headers,
1059
1058
  params=_params,
1060
1059
  )
1061
- _request = _convert_request(_request)
1062
1060
  _request.url = self._client.format_url(_request.url)
1063
1061
 
1064
1062
  _stream = False
@@ -1170,7 +1168,6 @@ class ContainerOperations:
1170
1168
  headers=_headers,
1171
1169
  params=_params,
1172
1170
  )
1173
- _request = _convert_request(_request)
1174
1171
  _request.url = self._client.format_url(_request.url)
1175
1172
 
1176
1173
  _stream = False
@@ -1268,7 +1265,6 @@ class ContainerOperations:
1268
1265
  headers=_headers,
1269
1266
  params=_params,
1270
1267
  )
1271
- _request = _convert_request(_request)
1272
1268
  _request.url = self._client.format_url(_request.url)
1273
1269
 
1274
1270
  _stream = False
@@ -1352,7 +1348,6 @@ class ContainerOperations:
1352
1348
  headers=_headers,
1353
1349
  params=_params,
1354
1350
  )
1355
- _request = _convert_request(_request)
1356
1351
  _request.url = self._client.format_url(_request.url)
1357
1352
 
1358
1353
  _stream = False
@@ -1380,7 +1375,7 @@ class ContainerOperations:
1380
1375
  response_headers["x-ms-version"] = self._deserialize("str", response.headers.get("x-ms-version"))
1381
1376
  response_headers["Date"] = self._deserialize("rfc-1123", response.headers.get("Date"))
1382
1377
 
1383
- deserialized = self._deserialize("[SignedIdentifier]", pipeline_response)
1378
+ deserialized = self._deserialize("[SignedIdentifier]", pipeline_response.http_response)
1384
1379
 
1385
1380
  if cls:
1386
1381
  return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -1471,7 +1466,6 @@ class ContainerOperations:
1471
1466
  headers=_headers,
1472
1467
  params=_params,
1473
1468
  )
1474
- _request = _convert_request(_request)
1475
1469
  _request.url = self._client.format_url(_request.url)
1476
1470
 
1477
1471
  _stream = False
@@ -1556,7 +1550,6 @@ class ContainerOperations:
1556
1550
  headers=_headers,
1557
1551
  params=_params,
1558
1552
  )
1559
- _request = _convert_request(_request)
1560
1553
  _request.url = self._client.format_url(_request.url)
1561
1554
 
1562
1555
  _stream = False
@@ -1639,7 +1632,6 @@ class ContainerOperations:
1639
1632
  headers=_headers,
1640
1633
  params=_params,
1641
1634
  )
1642
- _request = _convert_request(_request)
1643
1635
  _request.url = self._client.format_url(_request.url)
1644
1636
 
1645
1637
  _stream = False
@@ -1726,9 +1718,9 @@ class ContainerOperations:
1726
1718
  headers=_headers,
1727
1719
  params=_params,
1728
1720
  )
1729
- _request = _convert_request(_request)
1730
1721
  _request.url = self._client.format_url(_request.url)
1731
1722
 
1723
+ _decompress = kwargs.pop("decompress", True)
1732
1724
  _stream = True
1733
1725
  pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
1734
1726
  _request, stream=_stream, **kwargs
@@ -1737,6 +1729,10 @@ class ContainerOperations:
1737
1729
  response = pipeline_response.http_response
1738
1730
 
1739
1731
  if response.status_code not in [202]:
1732
+ try:
1733
+ response.read() # Load the body in memory and close the socket
1734
+ except (StreamConsumedError, StreamClosedError):
1735
+ pass
1740
1736
  map_error(status_code=response.status_code, response=response, error_map=error_map)
1741
1737
  error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response)
1742
1738
  raise HttpResponseError(response=response, model=error)
@@ -1746,7 +1742,7 @@ class ContainerOperations:
1746
1742
  response_headers["x-ms-request-id"] = self._deserialize("str", response.headers.get("x-ms-request-id"))
1747
1743
  response_headers["x-ms-version"] = self._deserialize("str", response.headers.get("x-ms-version"))
1748
1744
 
1749
- deserialized = response.stream_download(self._client._pipeline)
1745
+ deserialized = response.stream_download(self._client._pipeline, decompress=_decompress)
1750
1746
 
1751
1747
  if cls:
1752
1748
  return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -1829,7 +1825,6 @@ class ContainerOperations:
1829
1825
  headers=_headers,
1830
1826
  params=_params,
1831
1827
  )
1832
- _request = _convert_request(_request)
1833
1828
  _request.url = self._client.format_url(_request.url)
1834
1829
 
1835
1830
  _stream = False
@@ -1852,7 +1847,7 @@ class ContainerOperations:
1852
1847
  response_headers["x-ms-version"] = self._deserialize("str", response.headers.get("x-ms-version"))
1853
1848
  response_headers["Date"] = self._deserialize("rfc-1123", response.headers.get("Date"))
1854
1849
 
1855
- deserialized = self._deserialize("FilterBlobSegment", pipeline_response)
1850
+ deserialized = self._deserialize("FilterBlobSegment", pipeline_response.http_response)
1856
1851
 
1857
1852
  if cls:
1858
1853
  return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -1932,7 +1927,6 @@ class ContainerOperations:
1932
1927
  headers=_headers,
1933
1928
  params=_params,
1934
1929
  )
1935
- _request = _convert_request(_request)
1936
1930
  _request.url = self._client.format_url(_request.url)
1937
1931
 
1938
1932
  _stream = False
@@ -2026,7 +2020,6 @@ class ContainerOperations:
2026
2020
  headers=_headers,
2027
2021
  params=_params,
2028
2022
  )
2029
- _request = _convert_request(_request)
2030
2023
  _request.url = self._client.format_url(_request.url)
2031
2024
 
2032
2025
  _stream = False
@@ -2119,7 +2112,6 @@ class ContainerOperations:
2119
2112
  headers=_headers,
2120
2113
  params=_params,
2121
2114
  )
2122
- _request = _convert_request(_request)
2123
2115
  _request.url = self._client.format_url(_request.url)
2124
2116
 
2125
2117
  _stream = False
@@ -2219,7 +2211,6 @@ class ContainerOperations:
2219
2211
  headers=_headers,
2220
2212
  params=_params,
2221
2213
  )
2222
- _request = _convert_request(_request)
2223
2214
  _request.url = self._client.format_url(_request.url)
2224
2215
 
2225
2216
  _stream = False
@@ -2319,7 +2310,6 @@ class ContainerOperations:
2319
2310
  headers=_headers,
2320
2311
  params=_params,
2321
2312
  )
2322
- _request = _convert_request(_request)
2323
2313
  _request.url = self._client.format_url(_request.url)
2324
2314
 
2325
2315
  _stream = False
@@ -2423,7 +2413,6 @@ class ContainerOperations:
2423
2413
  headers=_headers,
2424
2414
  params=_params,
2425
2415
  )
2426
- _request = _convert_request(_request)
2427
2416
  _request.url = self._client.format_url(_request.url)
2428
2417
 
2429
2418
  _stream = False
@@ -2447,7 +2436,7 @@ class ContainerOperations:
2447
2436
  response_headers["x-ms-version"] = self._deserialize("str", response.headers.get("x-ms-version"))
2448
2437
  response_headers["Date"] = self._deserialize("rfc-1123", response.headers.get("Date"))
2449
2438
 
2450
- deserialized = self._deserialize("ListBlobsFlatSegmentResponse", pipeline_response)
2439
+ deserialized = self._deserialize("ListBlobsFlatSegmentResponse", pipeline_response.http_response)
2451
2440
 
2452
2441
  if cls:
2453
2442
  return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -2536,7 +2525,6 @@ class ContainerOperations:
2536
2525
  headers=_headers,
2537
2526
  params=_params,
2538
2527
  )
2539
- _request = _convert_request(_request)
2540
2528
  _request.url = self._client.format_url(_request.url)
2541
2529
 
2542
2530
  _stream = False
@@ -2560,7 +2548,7 @@ class ContainerOperations:
2560
2548
  response_headers["x-ms-version"] = self._deserialize("str", response.headers.get("x-ms-version"))
2561
2549
  response_headers["Date"] = self._deserialize("rfc-1123", response.headers.get("Date"))
2562
2550
 
2563
- deserialized = self._deserialize("ListBlobsHierarchySegmentResponse", pipeline_response)
2551
+ deserialized = self._deserialize("ListBlobsHierarchySegmentResponse", pipeline_response.http_response)
2564
2552
 
2565
2553
  if cls:
2566
2554
  return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -2611,7 +2599,6 @@ class ContainerOperations:
2611
2599
  headers=_headers,
2612
2600
  params=_params,
2613
2601
  )
2614
- _request = _convert_request(_request)
2615
2602
  _request.url = self._client.format_url(_request.url)
2616
2603
 
2617
2604
  _stream = False
@@ -19,14 +19,12 @@ from azure.core.exceptions import (
19
19
  map_error,
20
20
  )
21
21
  from azure.core.pipeline import PipelineResponse
22
- from azure.core.pipeline.transport import HttpResponse
23
- from azure.core.rest import HttpRequest
22
+ from azure.core.rest import HttpRequest, HttpResponse
24
23
  from azure.core.tracing.decorator import distributed_trace
25
24
  from azure.core.utils import case_insensitive_dict
26
25
 
27
26
  from .. import models as _models
28
27
  from .._serialization import Serializer
29
- from .._vendor import _convert_request
30
28
 
31
29
  if sys.version_info >= (3, 9):
32
30
  from collections.abc import MutableMapping
@@ -980,7 +978,6 @@ class PageBlobOperations:
980
978
  headers=_headers,
981
979
  params=_params,
982
980
  )
983
- _request = _convert_request(_request)
984
981
  _request.url = self._client.format_url(_request.url)
985
982
 
986
983
  _stream = False
@@ -1154,7 +1151,6 @@ class PageBlobOperations:
1154
1151
  headers=_headers,
1155
1152
  params=_params,
1156
1153
  )
1157
- _request = _convert_request(_request)
1158
1154
  _request.url = self._client.format_url(_request.url)
1159
1155
 
1160
1156
  _stream = False
@@ -1316,7 +1312,6 @@ class PageBlobOperations:
1316
1312
  headers=_headers,
1317
1313
  params=_params,
1318
1314
  )
1319
- _request = _convert_request(_request)
1320
1315
  _request.url = self._client.format_url(_request.url)
1321
1316
 
1322
1317
  _stream = False
@@ -1512,7 +1507,6 @@ class PageBlobOperations:
1512
1507
  headers=_headers,
1513
1508
  params=_params,
1514
1509
  )
1515
- _request = _convert_request(_request)
1516
1510
  _request.url = self._client.format_url(_request.url)
1517
1511
 
1518
1512
  _stream = False
@@ -1656,7 +1650,6 @@ class PageBlobOperations:
1656
1650
  headers=_headers,
1657
1651
  params=_params,
1658
1652
  )
1659
- _request = _convert_request(_request)
1660
1653
  _request.url = self._client.format_url(_request.url)
1661
1654
 
1662
1655
  _stream = False
@@ -1684,7 +1677,7 @@ class PageBlobOperations:
1684
1677
  response_headers["x-ms-version"] = self._deserialize("str", response.headers.get("x-ms-version"))
1685
1678
  response_headers["Date"] = self._deserialize("rfc-1123", response.headers.get("Date"))
1686
1679
 
1687
- deserialized = self._deserialize("PageList", pipeline_response)
1680
+ deserialized = self._deserialize("PageList", pipeline_response.http_response)
1688
1681
 
1689
1682
  if cls:
1690
1683
  return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -1810,7 +1803,6 @@ class PageBlobOperations:
1810
1803
  headers=_headers,
1811
1804
  params=_params,
1812
1805
  )
1813
- _request = _convert_request(_request)
1814
1806
  _request.url = self._client.format_url(_request.url)
1815
1807
 
1816
1808
  _stream = False
@@ -1838,7 +1830,7 @@ class PageBlobOperations:
1838
1830
  response_headers["x-ms-version"] = self._deserialize("str", response.headers.get("x-ms-version"))
1839
1831
  response_headers["Date"] = self._deserialize("rfc-1123", response.headers.get("Date"))
1840
1832
 
1841
- deserialized = self._deserialize("PageList", pipeline_response)
1833
+ deserialized = self._deserialize("PageList", pipeline_response.http_response)
1842
1834
 
1843
1835
  if cls:
1844
1836
  return cls(pipeline_response, deserialized, response_headers) # type: ignore
@@ -1942,7 +1934,6 @@ class PageBlobOperations:
1942
1934
  headers=_headers,
1943
1935
  params=_params,
1944
1936
  )
1945
- _request = _convert_request(_request)
1946
1937
  _request.url = self._client.format_url(_request.url)
1947
1938
 
1948
1939
  _stream = False
@@ -2058,7 +2049,6 @@ class PageBlobOperations:
2058
2049
  headers=_headers,
2059
2050
  params=_params,
2060
2051
  )
2061
- _request = _convert_request(_request)
2062
2052
  _request.url = self._client.format_url(_request.url)
2063
2053
 
2064
2054
  _stream = False
@@ -2165,7 +2155,6 @@ class PageBlobOperations:
2165
2155
  headers=_headers,
2166
2156
  params=_params,
2167
2157
  )
2168
- _request = _convert_request(_request)
2169
2158
  _request.url = self._client.format_url(_request.url)
2170
2159
 
2171
2160
  _stream = False