aio Package
Classes
| BlobClient |
A client to interact with a specific blob, although that blob may not yet exist. |
| BlobLeaseClient |
Creates a new BlobLeaseClient. This client provides lease operations on a BlobClient or ContainerClient. |
| BlobPrefix |
An Iterable of Blob properties. Returned from walk_blobs when a delimiter is used. Can be thought of as a virtual blob directory. |
| BlobServiceClient |
A client to interact with the Blob Service at the account level. This client provides operations to retrieve and configure the account properties as well as list, create and delete containers within the account. For operations relating to a specific container or blob, clients for those entities can also be retrieved using the get_client functions. |
| ContainerClient |
A client to interact with a specific container, although that container may not yet exist. For operations relating to a specific blob within this container, a blob client can be retrieved using the get_blob_client function. |
| ExponentialRetry |
Exponential retry. |
| LinearRetry |
Linear retry. |
| StorageStreamDownloader |
A streaming object to download from Azure Storage. |
Functions
download_blob_from_url
Download the contents of a blob to a local file or stream.
async download_blob_from_url(blob_url: str, output: str, credential: Any = None, **kwargs) -> None
Parameters
- output
- str or <xref:<xref:writable stream>>
Where the data should be downloaded to. This could be either a file path to write to, or an open IO handle to write to.
- credential
The credentials with which to authenticate. This is optional if the blob URL already has a SAS token or the blob is public. The value can be a SAS token string, an instance of a AzureSasCredential from azure.core.credentials, an account shared access key, or an instance of a TokenCredentials class from azure.identity. If the resource URI already contains a SAS token, this will be ignored in favor of an explicit credential
- except in the case of AzureSasCredential, where the conflicting SAS tokens will raise a ValueError.
- overwrite
- bool
Whether the local file should be overwritten if it already exists. The default value is False - in which case a ValueError will be raised if the file already exists. If set to True, an attempt will be made to write to the existing file. If a stream handle is passed in, this value is ignored.
- max_concurrency
- int
The number of parallel connections with which to download.
- offset
- int
Start of byte range to use for downloading a section of the blob. Must be set if length is provided.
- length
- int
Number of bytes to read from the stream. This is optional, but should be supplied for optimal performance.
- validate_content
- bool
If true, calculates an MD5 hash for each chunk of the blob. The storage service checks the hash of the content that has arrived with the hash that was sent. This is primarily valuable for detecting bitflips on the wire if using http instead of https as https (the default) will already validate. Note that this MD5 hash is not stored with the blob. Also note that if enabled, the memory-efficient upload algorithm will not be used, because computing the MD5 hash requires buffering entire blocks, and doing so defeats the purpose of the memory-efficient algorithm.
Return type
upload_blob_to_url
Upload data to a given URL
The data will be uploaded as a block blob.
async upload_blob_to_url(blob_url: str, data: Union[Iterable[AnyStr], IO[AnyStr]], credential: Any = None, **kwargs) -> dict[str, Any]
Parameters
The data to upload. This can be bytes, text, an iterable or a file-like object.
- credential
The credentials with which to authenticate. This is optional if the blob URL already has a SAS token. The value can be a SAS token string, an instance of a AzureSasCredential from azure.core.credentials, an account shared access key, or an instance of a TokenCredentials class from azure.identity. If the resource URI already contains a SAS token, this will be ignored in favor of an explicit credential
- except in the case of AzureSasCredential, where the conflicting SAS tokens will raise a ValueError.
- overwrite
- bool
Whether the blob to be uploaded should overwrite the current data. If True, upload_blob_to_url will overwrite any existing data. If set to False, the operation will fail with a ResourceExistsError.
- max_concurrency
- int
The number of parallel connections with which to download.
- length
- int
Number of bytes to read from the stream. This is optional, but should be supplied for optimal performance.
- metadata
- dict(<xref:str,str>)
Name-value pairs associated with the blob as metadata.
- validate_content
- bool
If true, calculates an MD5 hash for each chunk of the blob. The storage service checks the hash of the content that has arrived with the hash that was sent. This is primarily valuable for detecting bitflips on the wire if using http instead of https as https (the default) will already validate. Note that this MD5 hash is not stored with the blob. Also note that if enabled, the memory-efficient upload algorithm will not be used, because computing the MD5 hash requires buffering entire blocks, and doing so defeats the purpose of the memory-efficient algorithm.
- encoding
- str
Encoding to use if text is supplied as input. Defaults to UTF-8.
Returns
Blob-updated property dict (Etag and last modified)
Return type
Feedback
Submit and view feedback for