azure-storage-blob 12.26.0__py3-none-any.whl → 12.27.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 +3 -3
- azure/storage/blob/_blob_client.py +16 -0
- azure/storage/blob/_blob_client.pyi +780 -0
- azure/storage/blob/_blob_service_client.py +41 -4
- azure/storage/blob/_blob_service_client.pyi +182 -0
- azure/storage/blob/_container_client.py +22 -0
- azure/storage/blob/_container_client.pyi +380 -0
- azure/storage/blob/_generated/_azure_blob_storage.py +3 -2
- azure/storage/blob/_generated/_configuration.py +2 -2
- azure/storage/blob/_generated/_utils/__init__.py +6 -0
- azure/storage/blob/_generated/{_serialization.py → _utils/serialization.py} +4 -22
- azure/storage/blob/_generated/aio/_azure_blob_storage.py +3 -2
- azure/storage/blob/_generated/aio/_configuration.py +2 -2
- azure/storage/blob/_generated/aio/operations/_append_blob_operations.py +6 -10
- azure/storage/blob/_generated/aio/operations/_blob_operations.py +35 -39
- azure/storage/blob/_generated/aio/operations/_block_blob_operations.py +9 -13
- azure/storage/blob/_generated/aio/operations/_container_operations.py +20 -24
- azure/storage/blob/_generated/aio/operations/_page_blob_operations.py +13 -17
- azure/storage/blob/_generated/aio/operations/_service_operations.py +10 -14
- azure/storage/blob/_generated/models/_models_py3.py +30 -9
- azure/storage/blob/_generated/operations/_append_blob_operations.py +11 -15
- azure/storage/blob/_generated/operations/_blob_operations.py +60 -64
- azure/storage/blob/_generated/operations/_block_blob_operations.py +16 -20
- azure/storage/blob/_generated/operations/_container_operations.py +39 -43
- azure/storage/blob/_generated/operations/_page_blob_operations.py +23 -27
- azure/storage/blob/_generated/operations/_service_operations.py +19 -23
- azure/storage/blob/_lease.py +2 -2
- azure/storage/blob/_lease.pyi +81 -0
- azure/storage/blob/_list_blobs_helper.py +1 -1
- azure/storage/blob/_serialize.py +1 -0
- azure/storage/blob/_shared/base_client.py +0 -13
- azure/storage/blob/_shared/base_client_async.py +0 -22
- azure/storage/blob/_shared/models.py +1 -0
- azure/storage/blob/_shared/policies.py +10 -2
- azure/storage/blob/_shared/response_handlers.py +5 -0
- azure/storage/blob/_version.py +1 -1
- azure/storage/blob/aio/__init__.py +5 -8
- azure/storage/blob/aio/_blob_client_async.py +28 -8
- azure/storage/blob/aio/_blob_client_async.pyi +763 -0
- azure/storage/blob/aio/_blob_service_client_async.py +41 -4
- azure/storage/blob/aio/_blob_service_client_async.pyi +187 -0
- azure/storage/blob/aio/_container_client_async.py +27 -1
- azure/storage/blob/aio/_container_client_async.pyi +384 -0
- azure/storage/blob/aio/_lease_async.py +2 -2
- azure/storage/blob/aio/_lease_async.pyi +81 -0
- {azure_storage_blob-12.26.0.dist-info → azure_storage_blob-12.27.0.dist-info}/METADATA +17 -5
- {azure_storage_blob-12.26.0.dist-info → azure_storage_blob-12.27.0.dist-info}/RECORD +50 -41
- {azure_storage_blob-12.26.0.dist-info → azure_storage_blob-12.27.0.dist-info}/WHEEL +1 -1
- {azure_storage_blob-12.26.0.dist-info → azure_storage_blob-12.27.0.dist-info/licenses}/LICENSE +0 -0
- {azure_storage_blob-12.26.0.dist-info → azure_storage_blob-12.27.0.dist-info}/top_level.txt +0 -0
@@ -7,7 +7,7 @@
|
|
7
7
|
|
8
8
|
import os
|
9
9
|
|
10
|
-
from typing import Any, AnyStr, Dict,
|
10
|
+
from typing import Any, AnyStr, Dict, IO, Iterable, Optional, Union, TYPE_CHECKING
|
11
11
|
from ._list_blobs_helper import BlobPrefix
|
12
12
|
from .._models import BlobType
|
13
13
|
from .._shared.policies_async import ExponentialRetry, LinearRetry
|
@@ -76,11 +76,8 @@ async def upload_blob_to_url(
|
|
76
76
|
:return: Blob-updated property dict (Etag and last modified)
|
77
77
|
:rtype: dict[str, Any]
|
78
78
|
"""
|
79
|
-
async with BlobClient.from_blob_url(blob_url, credential=credential) as client:
|
80
|
-
return await
|
81
|
-
data=data,
|
82
|
-
blob_type=BlobType.BLOCKBLOB,
|
83
|
-
**kwargs)
|
79
|
+
async with BlobClient.from_blob_url(blob_url, credential=credential) as client: # pylint: disable=not-async-context-manager
|
80
|
+
return await client.upload_blob(data=data, blob_type=BlobType.BLOCKBLOB, **kwargs)
|
84
81
|
|
85
82
|
|
86
83
|
# Download data to specified open file-handle.
|
@@ -92,7 +89,7 @@ async def _download_to_stream(client, handle, **kwargs):
|
|
92
89
|
async def download_blob_from_url(
|
93
90
|
blob_url: str,
|
94
91
|
output: str,
|
95
|
-
credential: Optional[Union[str, Dict[str, str], "AzureNamedKeyCredential", "AzureSasCredential", "AsyncTokenCredential"]] = None,
|
92
|
+
credential: Optional[Union[str, Dict[str, str], "AzureNamedKeyCredential", "AzureSasCredential", "AsyncTokenCredential"]] = None, # pylint: disable=line-too-long
|
96
93
|
**kwargs: Any
|
97
94
|
) -> None:
|
98
95
|
"""Download the contents of a blob to a local file or stream.
|
@@ -143,7 +140,7 @@ async def download_blob_from_url(
|
|
143
140
|
:rtype: None
|
144
141
|
"""
|
145
142
|
overwrite = kwargs.pop('overwrite', False)
|
146
|
-
async with BlobClient.from_blob_url(blob_url, credential=credential) as client:
|
143
|
+
async with BlobClient.from_blob_url(blob_url, credential=credential) as client: # pylint: disable=not-async-context-manager
|
147
144
|
if hasattr(output, 'write'):
|
148
145
|
await _download_to_stream(client, output, **kwargs)
|
149
146
|
else:
|
@@ -30,7 +30,6 @@ from ._upload_helpers import (
|
|
30
30
|
upload_block_blob,
|
31
31
|
upload_page_blob
|
32
32
|
)
|
33
|
-
from .._blob_client import StorageAccountHostsMixin
|
34
33
|
from .._blob_client_helpers import (
|
35
34
|
_abort_copy_options,
|
36
35
|
_append_block_from_url_options,
|
@@ -74,6 +73,7 @@ from .._generated.aio import AzureBlobStorage
|
|
74
73
|
from .._generated.models import CpkInfo
|
75
74
|
from .._models import BlobType, BlobBlock, BlobProperties, BlobQueryError, PageRange
|
76
75
|
from .._serialize import get_access_conditions, get_api_version, get_modify_conditions, get_version_id
|
76
|
+
from .._shared.base_client import StorageAccountHostsMixin
|
77
77
|
from .._shared.base_client_async import AsyncStorageAccountHostsMixin, AsyncTransportWrapper, parse_connection_str
|
78
78
|
from .._shared.policies_async import ExponentialRetry
|
79
79
|
from .._shared.response_handlers import process_storage_error, return_response_headers
|
@@ -98,7 +98,11 @@ if TYPE_CHECKING:
|
|
98
98
|
)
|
99
99
|
|
100
100
|
|
101
|
-
class BlobClient(
|
101
|
+
class BlobClient( # type: ignore [misc] # pylint: disable=too-many-public-methods
|
102
|
+
AsyncStorageAccountHostsMixin,
|
103
|
+
StorageAccountHostsMixin,
|
104
|
+
StorageEncryptionMixin
|
105
|
+
):
|
102
106
|
"""A client to interact with a specific blob, although that blob may not yet exist.
|
103
107
|
|
104
108
|
:param str account_url:
|
@@ -165,12 +169,12 @@ class BlobClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, Storag
|
|
165
169
|
:caption: Creating the BlobClient from a SAS URL to a blob.
|
166
170
|
"""
|
167
171
|
def __init__(
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
172
|
+
self, account_url: str,
|
173
|
+
container_name: str,
|
174
|
+
blob_name: str,
|
175
|
+
snapshot: Optional[Union[str, Dict[str, Any]]] = None,
|
176
|
+
credential: Optional[Union[str, Dict[str, str], "AzureNamedKeyCredential", "AzureSasCredential", "AsyncTokenCredential"]] = None, # pylint: disable=line-too-long
|
177
|
+
**kwargs: Any
|
174
178
|
) -> None:
|
175
179
|
kwargs['retry_policy'] = kwargs.get('retry_policy') or ExponentialRetry(**kwargs)
|
176
180
|
parsed_url, sas_token, path_snapshot = _parse_url(
|
@@ -196,6 +200,22 @@ class BlobClient(AsyncStorageAccountHostsMixin, StorageAccountHostsMixin, Storag
|
|
196
200
|
self._client._config.version = get_api_version(kwargs) # type: ignore [assignment]
|
197
201
|
self._configure_encryption(kwargs)
|
198
202
|
|
203
|
+
async def __aenter__(self) -> Self:
|
204
|
+
await self._client.__aenter__()
|
205
|
+
return self
|
206
|
+
|
207
|
+
async def __aexit__(self, *args) -> None:
|
208
|
+
await self._client.__aexit__(*args)
|
209
|
+
|
210
|
+
async def close(self) -> None:
|
211
|
+
"""This method is to close the sockets opened by the client.
|
212
|
+
It need not be used when using with a context manager.
|
213
|
+
|
214
|
+
:return: None
|
215
|
+
:rtype: None
|
216
|
+
"""
|
217
|
+
await self._client.close()
|
218
|
+
|
199
219
|
def _format_url(self, hostname: str) -> str:
|
200
220
|
return _format_url(
|
201
221
|
container_name=self.container_name,
|