BlobClient Class
A client to interact with a specific blob, although that blob may not yet exist.
For more optional configuration, please click here.
- Inheritance
-
azure.storage.blob._shared.base_client.StorageAccountHostsMixinBlobClientazure.storage.blob._encryption.StorageEncryptionMixinBlobClient
Constructor
BlobClient(account_url: str, container_name: str, blob_name: str, snapshot: str | Dict[str, Any] | None = None, credential: str | Dict[str, str] | AzureNamedKeyCredential | AzureSasCredential | TokenCredential | None = None, **kwargs: Any)
Parameters
Name | Description |
---|---|
account_url
Required
|
The URI to the storage account. In order to create a client given the full URI to the blob, use the from_blob_url classmethod. |
container_name
Required
|
The container name for the blob. |
blob_name
Required
|
The name of the blob with which to interact. If specified, this value will override a blob value specified in the blob URL. |
snapshot
|
The optional blob snapshot on which to operate. This can be the snapshot ID string or the response returned from create_snapshot. Default value: None
|
credential
|
The credentials with which to authenticate. This is optional if the account URL already has a SAS token. The value can be a SAS token string, an instance of a AzureSasCredential or AzureNamedKeyCredential 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
Default value: None
|
Keyword-Only Parameters
Name | Description |
---|---|
api_version
|
The Storage API version to use for requests. Default value is the most recent service version that is compatible with the current SDK. Setting to an older version may result in reduced feature compatibility. New in version 12.2.0. |
secondary_hostname
|
The hostname of the secondary endpoint. |
max_block_size
|
The maximum chunk size for uploading a block blob in chunks.
Defaults to |
max_single_put_size
|
If the blob size is less than or equal max_single_put_size, then the blob will be
uploaded with only one http PUT request. If the blob size is larger than max_single_put_size,
the blob will be uploaded in chunks. Defaults to |
min_large_block_upload_threshold
|
The minimum chunk size required to use the memory efficient
algorithm when uploading a block blob. Defaults to |
use_byte_buffer
|
Use a byte buffer for block blob uploads. Defaults to False. |
max_page_size
|
The maximum chunk size for uploading a page blob. Defaults to |
max_single_get_size
|
The maximum size for a blob to be downloaded in a single call,
the exceeded part will be downloaded in chunks (could be parallel). Defaults to |
max_chunk_get_size
|
The maximum chunk size used for downloading a blob. Defaults to |
version_id
|
The version id parameter is an opaque DateTime value that, when present, specifies the version of the blob to operate on. |
audience
|
The audience to use when requesting tokens for Azure Active Directory authentication. Only has an effect when credential is of type TokenCredential. The value could be https://storage.azure.com/ (default) or https://.blob.core.windows.net. |
Methods
abort_copy |
Abort an ongoing copy operation. This will leave a destination blob with zero length and full metadata. This will raise an error if the copy operation has already ended. |
acquire_lease |
Requests a new lease. If the blob does not have an active lease, the Blob Service creates a lease on the blob and returns a new lease. |
append_block |
Commits a new block of data to the end of the existing append blob. |
append_block_from_url |
Creates a new block to be committed as part of a blob, where the contents are read from a source url. |
clear_page |
Clears a range of pages. |
close |
This method is to close the sockets opened by the client. It need not be used when using with a context manager. |
commit_block_list |
The Commit Block List operation writes a blob by specifying the list of block IDs that make up the blob. |
create_append_blob |
Creates a new Append Blob. This operation creates a new 0-length append blob. The content of any existing blob is overwritten with the newly initialized append blob. To add content to the append blob, call the append_block or append_block_from_url method. |
create_page_blob |
Creates a new Page Blob of the specified size. |
create_snapshot |
Creates a snapshot of the blob. A snapshot is a read-only version of a blob that's taken at a point in time. It can be read, copied, or deleted, but not modified. Snapshots provide a way to back up a blob as it appears at a moment in time. A snapshot of a blob has the same name as the base blob from which the snapshot is taken, with a DateTime value appended to indicate the time at which the snapshot was taken. |
delete_blob |
Marks the specified blob for deletion. The blob is later deleted during garbage collection. Note that in order to delete a blob, you must delete all of its snapshots. You can delete both at the same time with the delete_blob() operation. If a delete retention policy is enabled for the service, then this operation soft deletes the blob and retains the blob for a specified number of days. After the specified number of days, the blob's data is removed from the service during garbage collection. Soft deleted blob is accessible through list_blobs specifying include=['deleted'] option. Soft-deleted blob can be restored using <xref:azure.storage.blob.undelete> operation. |
delete_immutability_policy |
The Delete Immutability Policy operation deletes the immutability policy on the blob. New in version 12.10.0: This operation was introduced in API version '2020-10-02'. |
download_blob |
Downloads a blob to the StorageStreamDownloader. The readall() method must be used to read all the content or readinto() must be used to download the blob into a stream. Using chunks() returns an iterator which allows the user to iterate over the content in chunks. |
exists |
Returns True if a blob exists with the defined parameters, and returns False otherwise. |
from_blob_url |
Create BlobClient from a blob url. This doesn't support customized blob url with '/' in blob name. |
from_connection_string |
Create BlobClient from a Connection String. |
get_account_information |
Gets information related to the storage account in which the blob resides. The information can also be retrieved if the user has a SAS to a container or blob. The keys in the returned dictionary include 'sku_name' and 'account_kind'. |
get_blob_properties |
Returns all user-defined metadata, standard HTTP properties, and system properties for the blob. It does not return the content of the blob. |
get_blob_tags |
The Get Tags operation enables users to get tags on a blob or specific blob version, or snapshot. New in version 12.4.0: This operation was introduced in API version '2019-12-12'. |
get_block_list |
The Get Block List operation retrieves the list of blocks that have been uploaded as part of a block blob. |
get_page_range_diff_for_managed_disk |
Returns the list of valid page ranges for a managed disk or snapshot. Note This operation is only available for managed disk accounts. New in version 12.2.0: This operation was introduced in API version '2019-07-07'. |
get_page_ranges |
DEPRECATED: Returns the list of valid page ranges for a Page Blob or snapshot of a page blob. |
list_page_ranges |
Returns the list of valid page ranges for a Page Blob or snapshot of a page blob. If previous_snapshot is specified, the result will be a diff of changes between the target blob and the previous snapshot. |
query_blob |
Enables users to select/project on blob/or blob snapshot data by providing simple query expressions. This operations returns a BlobQueryReader, users need to use readall() or readinto() to get query data. |
resize_blob |
Resizes a page blob to the specified size. If the specified value is less than the current size of the blob, then all pages above the specified value are cleared. |
seal_append_blob |
The Seal operation seals the Append Blob to make it read-only. New in version 12.4.0. |
set_blob_metadata |
Sets user-defined metadata for the blob as one or more name-value pairs. |
set_blob_tags |
The Set Tags operation enables users to set tags on a blob or specific blob version, but not snapshot. Each call to this operation replaces all existing tags attached to the blob. To remove all tags from the blob, call this operation with no tags set. New in version 12.4.0: This operation was introduced in API version '2019-12-12'. |
set_http_headers |
Sets system properties on the blob. If one property is set for the content_settings, all properties will be overridden. |
set_immutability_policy |
The Set Immutability Policy operation sets the immutability policy on the blob. New in version 12.10.0: This operation was introduced in API version '2020-10-02'. |
set_legal_hold |
The Set Legal Hold operation sets a legal hold on the blob. New in version 12.10.0: This operation was introduced in API version '2020-10-02'. |
set_premium_page_blob_tier |
Sets the page blob tiers on the blob. This API is only supported for page blobs on premium accounts. |
set_sequence_number |
Sets the blob sequence number. |
set_standard_blob_tier |
This operation sets the tier on a block blob. A block blob's tier determines Hot/Cool/Archive storage type. This operation does not update the blob's ETag. |
stage_block |
Creates a new block to be committed as part of a blob. |
stage_block_from_url |
Creates a new block to be committed as part of a blob where the contents are read from a URL. |
start_copy_from_url |
Copies a blob from the given URL. This operation returns a dictionary containing copy_status and copy_id, which can be used to check the status of or abort the copy operation. copy_status will be 'success' if the copy completed synchronously or 'pending' if the copy has been started asynchronously. For asynchronous copies, the status can be checked by polling the get_blob_properties method and checking the copy status. Set requires_sync to True to force the copy to be synchronous. The Blob service copies blobs on a best-effort basis. The source blob for a copy operation may be a block blob, an append blob, or a page blob. If the destination blob already exists, it must be of the same blob type as the source blob. Any existing destination blob will be overwritten. The destination blob cannot be modified while a copy operation is in progress. When copying from a page blob, the Blob service creates a destination page blob of the source blob's length, initially containing all zeroes. Then the source page ranges are enumerated, and non-empty ranges are copied. For a block blob or an append blob, the Blob service creates a committed blob of zero length before returning from this operation. When copying from a block blob, all committed blocks and their block IDs are copied. Uncommitted blocks are not copied. At the end of the copy operation, the destination blob will have the same committed block count as the source. When copying from an append blob, all committed blocks are copied. At the end of the copy operation, the destination blob will have the same committed block count as the source. |
undelete_blob |
Restores soft-deleted blobs or snapshots. Operation will only be successful if used within the specified number of days set in the delete retention policy. If blob versioning is enabled, the base blob cannot be restored using this method. Instead use start_copy_from_url with the URL of the blob version you wish to promote to the current version. |
upload_blob |
Creates a new blob from a data source with automatic chunking. |
upload_blob_from_url |
Creates a new Block Blob where the content of the blob is read from a given URL. The content of an existing blob is overwritten with the new blob. |
upload_page |
The Upload Pages operation writes a range of pages to a page blob. |
upload_pages_from_url |
The Upload Pages operation writes a range of pages to a page blob where the contents are read from a URL. |
abort_copy
Abort an ongoing copy operation.
This will leave a destination blob with zero length and full metadata. This will raise an error if the copy operation has already ended.
abort_copy(copy_id: str | Dict[str, Any] | BlobProperties, **kwargs: Any) -> None
Parameters
Name | Description |
---|---|
copy_id
Required
|
The copy operation to abort. This can be either an ID string, or an instance of BlobProperties. |
Returns
Type | Description |
---|---|
acquire_lease
Requests a new lease.
If the blob does not have an active lease, the Blob Service creates a lease on the blob and returns a new lease.
acquire_lease(lease_duration: int = -1, lease_id: str | None = None, **kwargs: Any) -> BlobLeaseClient
Parameters
Name | Description |
---|---|
lease_duration
Required
|
Specifies the duration of the lease, in seconds, or negative one (-1) for a lease that never expires. A non-infinite lease can be between 15 and 60 seconds. A lease duration cannot be changed using renew or change. Default is -1 (infinite lease). |
lease_id
Required
|
Proposed lease ID, in a GUID string format. The Blob Service returns 400 (Invalid request) if the proposed lease ID is not in the correct format. |
Keyword-Only Parameters
Name | Description |
---|---|
if_modified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has been modified since the specified time. |
if_unmodified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has not been modified since the specified date/time. |
etag
|
An ETag value, or the wildcard character (*). Used to check if the resource has changed, and act according to the condition specified by the match_condition parameter. |
match_condition
|
The match condition to use upon the etag. |
if_tags_match_condition
|
Specify a SQL where clause on blob tags to operate only on blob with a matching value.
eg. New in version 12.4.0. |
timeout
|
Sets the server-side timeout for the operation in seconds. For more details see https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations. This value is not tracked or validated on the client. To configure client-side network timesouts see here. |
Returns
Type | Description |
---|---|
A BlobLeaseClient object. |
append_block
Commits a new block of data to the end of the existing append blob.
append_block(data: bytes | str | Iterable | IO, length: int | None = None, **kwargs: Any) -> Dict[str, str | datetime | int]
Parameters
Name | Description |
---|---|
data
Required
|
Content of the block. This can be bytes, text, an iterable or a file-like object. |
length
Required
|
Size of the block in bytes. |
Keyword-Only Parameters
Name | Description |
---|---|
validate_content
|
If true, calculates an MD5 hash of the block content. 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. |
maxsize_condition
|
Optional conditional header. The max length in bytes permitted for the append blob. If the Append Block operation would cause the blob to exceed that limit or if the blob size is already greater than the value specified in this header, the request will fail with MaxBlobSizeConditionNotMet error (HTTP status code 412 - Precondition Failed). |
appendpos_condition
|
Optional conditional header, used only for the Append Block operation. A number indicating the byte offset to compare. Append Block will succeed only if the append position is equal to this number. If it is not, the request will fail with the AppendPositionConditionNotMet error (HTTP status code 412 - Precondition Failed). |
lease
|
Required if the blob has an active lease. Value can be a BlobLeaseClient object or the lease ID as a string. |
if_modified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has been modified since the specified time. |
if_unmodified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has not been modified since the specified date/time. |
etag
|
An ETag value, or the wildcard character (*). Used to check if the resource has changed, and act according to the condition specified by the match_condition parameter. |
match_condition
|
The match condition to use upon the etag. |
if_tags_match_condition
|
Specify a SQL where clause on blob tags to operate only on blob with a matching value.
eg. New in version 12.4.0. |
encoding
|
Defaults to UTF-8. |
cpk
|
Encrypts the data on the service-side with the given key. Use of customer-provided keys must be done over HTTPS. As the encryption key itself is provided in the request, a secure connection must be established to transfer the key. |
encryption_scope
|
A predefined encryption scope used to encrypt the data on the service. An encryption scope can be created using the Management API and referenced here by name. If a default encryption scope has been defined at the container, this value will override it if the container-level scope is configured to allow overrides. Otherwise an error will be raised. New in version 12.2.0. |
timeout
|
Sets the server-side timeout for the operation in seconds. For more details see https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations. This value is not tracked or validated on the client. To configure client-side network timesouts see here. |
Returns
Type | Description |
---|---|
Blob-updated property dict (Etag, last modified, append offset, committed block count). |
append_block_from_url
Creates a new block to be committed as part of a blob, where the contents are read from a source url.
append_block_from_url(copy_source_url: str, source_offset: int | None = None, source_length: int | None = None, **kwargs: Any) -> Dict[str, str | datetime | int]
Parameters
Name | Description |
---|---|
copy_source_url
Required
|
The URL of the source data. It can point to any Azure Blob or File, that is either public or has a shared access signature attached. |
source_offset
Required
|
This indicates the start of the range of bytes (inclusive) that has to be taken from the copy source. |
source_length
Required
|
This indicates the end of the range of bytes that has to be taken from the copy source. |
Keyword-Only Parameters
Name | Description |
---|---|
source_content_md5
|
If given, the service will calculate the MD5 hash of the block content and compare against this value. |
maxsize_condition
|
Optional conditional header. The max length in bytes permitted for the append blob. If the Append Block operation would cause the blob to exceed that limit or if the blob size is already greater than the value specified in this header, the request will fail with MaxBlobSizeConditionNotMet error (HTTP status code 412 - Precondition Failed). |
appendpos_condition
|
Optional conditional header, used only for the Append Block operation. A number indicating the byte offset to compare. Append Block will succeed only if the append position is equal to this number. If it is not, the request will fail with the AppendPositionConditionNotMet error (HTTP status code 412 - Precondition Failed). |
lease
|
Required if the blob has an active lease. Value can be a BlobLeaseClient object or the lease ID as a string. |
if_modified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has been modified since the specified time. |
if_unmodified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has not been modified since the specified date/time. |
etag
|
The destination ETag value, or the wildcard character (*). Used to check if the resource has changed, and act according to the condition specified by the match_condition parameter. |
match_condition
|
The destination match condition to use upon the etag. |
if_tags_match_condition
|
Specify a SQL where clause on blob tags to operate only on blob with a matching value.
eg. New in version 12.4.0. |
source_if_modified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the source resource has been modified since the specified time. |
source_if_unmodified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the source resource has not been modified since the specified date/time. |
source_etag
|
The source ETag value, or the wildcard character (*). Used to check if the resource has changed, and act according to the condition specified by the match_condition parameter. |
source_match_condition
|
The source match condition to use upon the etag. |
cpk
|
Encrypts the data on the service-side with the given key. Use of customer-provided keys must be done over HTTPS. As the encryption key itself is provided in the request, a secure connection must be established to transfer the key. |
encryption_scope
|
A predefined encryption scope used to encrypt the data on the service. An encryption scope can be created using the Management API and referenced here by name. If a default encryption scope has been defined at the container, this value will override it if the container-level scope is configured to allow overrides. Otherwise an error will be raised. New in version 12.2.0. |
timeout
|
Sets the server-side timeout for the operation in seconds. For more details see https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations. This value is not tracked or validated on the client. To configure client-side network timesouts see here. |
source_authorization
|
Authenticate as a service principal using a client secret to access a source blob. Ensure "bearer " is the prefix of the source_authorization string. |
Returns
Type | Description |
---|---|
Result after appending a new block. |
clear_page
Clears a range of pages.
clear_page(offset: int, length: int, **kwargs: Any) -> Dict[str, str | datetime]
Parameters
Name | Description |
---|---|
offset
Required
|
Start of byte range to use for writing to a section of the blob. Pages must be aligned with 512-byte boundaries, the start offset must be a modulus of 512 and the length must be a modulus of 512. |
length
Required
|
Number of bytes to use for writing to a section of the blob. Pages must be aligned with 512-byte boundaries, the start offset must be a modulus of 512 and the length must be a modulus of 512. |
Keyword-Only Parameters
Name | Description |
---|---|
lease
|
Required if the blob has an active lease. Value can be a BlobLeaseClient object or the lease ID as a string. |
if_sequence_number_lte
|
If the blob's sequence number is less than or equal to the specified value, the request proceeds; otherwise it fails. |
if_sequence_number_lt
|
If the blob's sequence number is less than the specified value, the request proceeds; otherwise it fails. |
if_sequence_number_eq
|
If the blob's sequence number is equal to the specified value, the request proceeds; otherwise it fails. |
if_modified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has been modified since the specified time. |
if_unmodified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has not been modified since the specified date/time. |
etag
|
An ETag value, or the wildcard character (*). Used to check if the resource has changed, and act according to the condition specified by the match_condition parameter. |
match_condition
|
The match condition to use upon the etag. |
if_tags_match_condition
|
Specify a SQL where clause on blob tags to operate only on blob with a matching value.
eg. New in version 12.4.0. |
cpk
|
Encrypts the data on the service-side with the given key. Use of customer-provided keys must be done over HTTPS. As the encryption key itself is provided in the request, a secure connection must be established to transfer the key. |
timeout
|
Sets the server-side timeout for the operation in seconds. For more details see https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations. This value is not tracked or validated on the client. To configure client-side network timesouts see here. |
Returns
Type | Description |
---|---|
Blob-updated property dict (Etag and last modified). |
close
This method is to close the sockets opened by the client. It need not be used when using with a context manager.
close()
commit_block_list
The Commit Block List operation writes a blob by specifying the list of block IDs that make up the blob.
commit_block_list(block_list: List[BlobBlock], content_settings: ContentSettings | None = None, metadata: Dict[str, str] | None = None, **kwargs: Any) -> Dict[str, str | datetime]
Parameters
Name | Description |
---|---|
block_list
Required
|
List of Blockblobs. |
content_settings
Required
|
ContentSettings object used to set blob properties. Used to set content type, encoding, language, disposition, md5, and cache control. |
metadata
Required
|
Name-value pairs associated with the blob as metadata. |
Keyword-Only Parameters
Name | Description |
---|---|
tags
|
Name-value pairs associated with the blob as tag. Tags are case-sensitive. The tag set may contain at most 10 tags. Tag keys must be between 1 and 128 characters, and tag values must be between 0 and 256 characters. Valid tag key and value characters include: lowercase and uppercase letters, digits (0-9), space (' '), plus (+), minus (-), period (.), solidus (/), colon (:), equals (=), underscore (_) New in version 12.4.0. |
lease
|
Required if the blob has an active lease. Value can be a BlobLeaseClient object or the lease ID as a string. |
immutability_policy
|
Specifies the immutability policy of a blob, blob snapshot or blob version. New in version 12.10.0: This was introduced in API version '2020-10-02'. |
legal_hold
|
Specified if a legal hold should be set on the blob. New in version 12.10.0: This was introduced in API version '2020-10-02'. |
validate_content
|
If true, calculates an MD5 hash of the page content. 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. |
if_modified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has been modified since the specified time. |
if_unmodified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has not been modified since the specified date/time. |
etag
|
An ETag value, or the wildcard character (*). Used to check if the resource has changed, and act according to the condition specified by the match_condition parameter. |
match_condition
|
The match condition to use upon the etag. |
if_tags_match_condition
|
Specify a SQL where clause on blob tags to operate only on destination blob with a matching value. New in version 12.4.0. |
standard_blob_tier
|
A standard blob tier value to set the blob to. For this version of the library, this is only applicable to block blobs on standard storage accounts. |
cpk
|
Encrypts the data on the service-side with the given key. Use of customer-provided keys must be done over HTTPS. As the encryption key itself is provided in the request, a secure connection must be established to transfer the key. |
encryption_scope
|
A predefined encryption scope used to encrypt the data on the service. An encryption scope can be created using the Management API and referenced here by name. If a default encryption scope has been defined at the container, this value will override it if the container-level scope is configured to allow overrides. Otherwise an error will be raised. New in version 12.2.0. |
timeout
|
Sets the server-side timeout for the operation in seconds. For more details see https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations. This value is not tracked or validated on the client. To configure client-side network timesouts see here. |
Returns
Type | Description |
---|---|
Blob-updated property dict (Etag and last modified). |
create_append_blob
Creates a new Append Blob. This operation creates a new 0-length append blob. The content of any existing blob is overwritten with the newly initialized append blob. To add content to the append blob, call the append_block or append_block_from_url method.
create_append_blob(content_settings: ContentSettings | None = None, metadata: Dict[str, str] | None = None, **kwargs: Any) -> Dict[str, str | datetime]
Parameters
Name | Description |
---|---|
content_settings
Required
|
ContentSettings object used to set blob properties. Used to set content type, encoding, language, disposition, md5, and cache control. |
metadata
Required
|
Name-value pairs associated with the blob as metadata. |
Keyword-Only Parameters
Name | Description |
---|---|
tags
|
Name-value pairs associated with the blob as tag. Tags are case-sensitive. The tag set may contain at most 10 tags. Tag keys must be between 1 and 128 characters, and tag values must be between 0 and 256 characters. Valid tag key and value characters include: lowercase and uppercase letters, digits (0-9), space (' '), plus (+), minus (-), period (.), solidus (/), colon (:), equals (=), underscore (_) New in version 12.4.0. |
lease
|
Required if the blob has an active lease. Value can be a BlobLeaseClient object or the lease ID as a string. |
immutability_policy
|
Specifies the immutability policy of a blob, blob snapshot or blob version. New in version 12.10.0: This was introduced in API version '2020-10-02'. |
legal_hold
|
Specified if a legal hold should be set on the blob. New in version 12.10.0: This was introduced in API version '2020-10-02'. |
if_modified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has been modified since the specified time. |
if_unmodified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has not been modified since the specified date/time. |
etag
|
An ETag value, or the wildcard character (*). Used to check if the resource has changed, and act according to the condition specified by the match_condition parameter. |
match_condition
|
The match condition to use upon the etag. |
cpk
|
Encrypts the data on the service-side with the given key. Use of customer-provided keys must be done over HTTPS. As the encryption key itself is provided in the request, a secure connection must be established to transfer the key. |
encryption_scope
|
A predefined encryption scope used to encrypt the data on the service. An encryption scope can be created using the Management API and referenced here by name. If a default encryption scope has been defined at the container, this value will override it if the container-level scope is configured to allow overrides. Otherwise an error will be raised. New in version 12.2.0. |
timeout
|
Sets the server-side timeout for the operation in seconds. For more details see https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations. This value is not tracked or validated on the client. To configure client-side network timesouts see here. |
Returns
Type | Description |
---|---|
Blob-updated property dict (Etag and last modified). |
create_page_blob
Creates a new Page Blob of the specified size.
create_page_blob(size: int, content_settings: ContentSettings | None = None, metadata: Dict[str, str] | None = None, premium_page_blob_tier: str | PremiumPageBlobTier | None = None, **kwargs: Any) -> Dict[str, str | datetime]
Parameters
Name | Description |
---|---|
size
Required
|
This specifies the maximum size for the page blob, up to 1 TB. The page blob size must be aligned to a 512-byte boundary. |
content_settings
Required
|
ContentSettings object used to set blob properties. Used to set content type, encoding, language, disposition, md5, and cache control. |
metadata
Required
|
Name-value pairs associated with the blob as metadata. |
premium_page_blob_tier
Required
|
A page blob tier value to set the blob to. The tier correlates to the size of the blob and number of allowed IOPS. This is only applicable to page blobs on premium storage accounts. |
Keyword-Only Parameters
Name | Description |
---|---|
tags
|
Name-value pairs associated with the blob as tag. Tags are case-sensitive. The tag set may contain at most 10 tags. Tag keys must be between 1 and 128 characters, and tag values must be between 0 and 256 characters. Valid tag key and value characters include: lowercase and uppercase letters, digits (0-9), space (' '), plus (+), minus (-), period (.), solidus (/), colon (:), equals (=), underscore (_) New in version 12.4.0. |
sequence_number
|
Only for Page blobs. The sequence number is a user-controlled value that you can use to track requests. The value of the sequence number must be between 0 and 2^63 - 1.The default value is 0. |
lease
|
Required if the blob has an active lease. Value can be a BlobLeaseClient object or the lease ID as a string. |
immutability_policy
|
Specifies the immutability policy of a blob, blob snapshot or blob version. New in version 12.10.0: This was introduced in API version '2020-10-02'. |
legal_hold
|
Specified if a legal hold should be set on the blob. New in version 12.10.0: This was introduced in API version '2020-10-02'. |
if_modified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has been modified since the specified time. |
if_unmodified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has not been modified since the specified date/time. |
etag
|
An ETag value, or the wildcard character (*). Used to check if the resource has changed, and act according to the condition specified by the match_condition parameter. |
match_condition
|
The match condition to use upon the etag. |
cpk
|
Encrypts the data on the service-side with the given key. Use of customer-provided keys must be done over HTTPS. As the encryption key itself is provided in the request, a secure connection must be established to transfer the key. |
encryption_scope
|
A predefined encryption scope used to encrypt the data on the service. An encryption scope can be created using the Management API and referenced here by name. If a default encryption scope has been defined at the container, this value will override it if the container-level scope is configured to allow overrides. Otherwise an error will be raised. New in version 12.2.0. |
timeout
|
Sets the server-side timeout for the operation in seconds. For more details see https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations. This value is not tracked or validated on the client. To configure client-side network timesouts see here. |
Returns
Type | Description |
---|---|
Blob-updated property dict (Etag and last modified). |
create_snapshot
Creates a snapshot of the blob.
A snapshot is a read-only version of a blob that's taken at a point in time. It can be read, copied, or deleted, but not modified. Snapshots provide a way to back up a blob as it appears at a moment in time.
A snapshot of a blob has the same name as the base blob from which the snapshot is taken, with a DateTime value appended to indicate the time at which the snapshot was taken.
create_snapshot(metadata: Dict[str, str] | None = None, **kwargs: Any) -> Dict[str, str | datetime]
Parameters
Name | Description |
---|---|
metadata
Required
|
Name-value pairs associated with the blob as metadata. |
Keyword-Only Parameters
Name | Description |
---|---|
if_modified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has been modified since the specified time. |
if_unmodified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has not been modified since the specified date/time. |
etag
|
An ETag value, or the wildcard character (*). Used to check if the resource has changed, and act according to the condition specified by the match_condition parameter. |
match_condition
|
The match condition to use upon the etag. |
if_tags_match_condition
|
Specify a SQL where clause on blob tags to operate only on destination blob with a matching value. New in version 12.4.0. |
lease
|
Required if the blob has an active lease. Value can be a BlobLeaseClient object or the lease ID as a string. |
cpk
|
Encrypts the data on the service-side with the given key. Use of customer-provided keys must be done over HTTPS. As the encryption key itself is provided in the request, a secure connection must be established to transfer the key. |
encryption_scope
|
A predefined encryption scope used to encrypt the data on the service. An encryption scope can be created using the Management API and referenced here by name. If a default encryption scope has been defined at the container, this value will override it if the container-level scope is configured to allow overrides. Otherwise an error will be raised. New in version 12.2.0. |
timeout
|
Sets the server-side timeout for the operation in seconds. For more details see https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations. This value is not tracked or validated on the client. To configure client-side network timesouts see here. |
Returns
Type | Description |
---|---|
Blob-updated property dict (Snapshot ID, Etag, and last modified). |
delete_blob
Marks the specified blob for deletion.
The blob is later deleted during garbage collection. Note that in order to delete a blob, you must delete all of its snapshots. You can delete both at the same time with the delete_blob() operation.
If a delete retention policy is enabled for the service, then this operation soft deletes the blob and retains the blob for a specified number of days. After the specified number of days, the blob's data is removed from the service during garbage collection. Soft deleted blob is accessible through list_blobs specifying include=['deleted'] option. Soft-deleted blob can be restored using <xref:azure.storage.blob.undelete> operation.
delete_blob(delete_snapshots: str | None = None, **kwargs: Any) -> None
Parameters
Name | Description |
---|---|
delete_snapshots
Required
|
Required if the blob has associated snapshots. Values include:
|
Keyword-Only Parameters
Name | Description |
---|---|
version_id
|
The version id parameter is an opaque DateTime value that, when present, specifies the version of the blob to delete. New in version 12.4.0. This keyword argument was introduced in API version '2019-12-12'. |
lease
|
Required if the blob has an active lease. If specified, delete_blob only succeeds if the blob's lease is active and matches this ID. Value can be a BlobLeaseClient object or the lease ID as a string. |
if_modified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has been modified since the specified time. |
if_unmodified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has not been modified since the specified date/time. |
etag
|
An ETag value, or the wildcard character (*). Used to check if the resource has changed, and act according to the condition specified by the match_condition parameter. |
match_condition
|
The match condition to use upon the etag. |
if_tags_match_condition
|
Specify a SQL where clause on blob tags to operate only on blob with a matching value.
eg. New in version 12.4.0. |
timeout
|
Sets the server-side timeout for the operation in seconds. For more details see https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations. This value is not tracked or validated on the client. To configure client-side network timesouts see here. |
Returns
Type | Description |
---|---|
delete_immutability_policy
The Delete Immutability Policy operation deletes the immutability policy on the blob.
New in version 12.10.0: This operation was introduced in API version '2020-10-02'.
delete_immutability_policy(**kwargs: Any) -> None
Keyword-Only Parameters
Name | Description |
---|---|
timeout
|
Sets the server-side timeout for the operation in seconds. For more details see https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations. This value is not tracked or validated on the client. To configure client-side network timesouts see here. |
Returns
Type | Description |
---|---|
Key value pairs of blob tags. |
download_blob
Downloads a blob to the StorageStreamDownloader. The readall() method must be used to read all the content or readinto() must be used to download the blob into a stream. Using chunks() returns an iterator which allows the user to iterate over the content in chunks.
download_blob(offset: int | None = None, length: int | None = None, *, encoding: str, **kwargs: Any) -> StorageStreamDownloader[str]
Parameters
Name | Description |
---|---|
offset
Required
|
Start of byte range to use for downloading a section of the blob. Must be set if length is provided. |
length
Required
|
Number of bytes to read from the stream. This is optional, but should be supplied for optimal performance. |
Keyword-Only Parameters
Name | Description |
---|---|
version_id
|
The version id parameter is an opaque DateTime value that, when present, specifies the version of the blob to download. New in version 12.4.0. This keyword argument was introduced in API version '2019-12-12'. |
validate_content
|
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. |
lease
|
Required if the blob has an active lease. If specified, download_blob only succeeds if the blob's lease is active and matches this ID. Value can be a BlobLeaseClient object or the lease ID as a string. |
if_modified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has been modified since the specified time. |
if_unmodified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has not been modified since the specified date/time. |
etag
|
An ETag value, or the wildcard character (*). Used to check if the resource has changed, and act according to the condition specified by the match_condition parameter. |
match_condition
|
The match condition to use upon the etag. |
if_tags_match_condition
|
Specify a SQL where clause on blob tags to operate only on blob with a matching value.
eg. New in version 12.4.0. |
cpk
|
Encrypts the data on the service-side with the given key. Use of customer-provided keys must be done over HTTPS. As the encryption key itself is provided in the request, a secure connection must be established to transfer the key. |
max_concurrency
|
The number of parallel connections with which to download. |
encoding
|
Encoding to decode the downloaded bytes. Default is None, i.e. no decoding. |
progress_hook
|
A callback to track the progress of a long running download. The signature is function(current: int, total: int) where current is the number of bytes transferred so far, and total is the total size of the download. |
timeout
|
Sets the server-side timeout for the operation in seconds. For more details see https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations. This value is not tracked or validated on the client. To configure client-side network timesouts see here. This method may make multiple calls to the service and the timeout will apply to each call individually. multiple calls to the Azure service and the timeout will apply to each call individually. |
Returns
Type | Description |
---|---|
A streaming object (StorageStreamDownloader) |
exists
Returns True if a blob exists with the defined parameters, and returns False otherwise.
exists(**kwargs: Any) -> bool
Keyword-Only Parameters
Name | Description |
---|---|
version_id
|
The version id parameter is an opaque DateTime value that, when present, specifies the version of the blob to check if it exists. |
timeout
|
Sets the server-side timeout for the operation in seconds. For more details see https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations. This value is not tracked or validated on the client. To configure client-side network timesouts see here. |
Returns
Type | Description |
---|---|
boolean |
from_blob_url
Create BlobClient from a blob url. This doesn't support customized blob url with '/' in blob name.
from_blob_url(blob_url: str, credential: str | Dict[str, str] | AzureNamedKeyCredential | AzureSasCredential | TokenCredential | None = None, snapshot: str | Dict[str, Any] | None = None, **kwargs: Any) -> Self
Parameters
Name | Description |
---|---|
blob_url
Required
|
The full endpoint URL to the Blob, including SAS token and snapshot if used. This could be either the primary endpoint, or the secondary endpoint depending on the current location_mode. |
credential
|
The credentials with which to authenticate. This is optional if the account URL already has a SAS token, or the connection string already has shared access key values. The value can be a SAS token string, an instance of a AzureSasCredential or AzureNamedKeyCredential 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
Default value: None
|
snapshot
|
The optional blob snapshot on which to operate. This can be the snapshot ID string or the response returned from create_snapshot. If specified, this will override the snapshot in the url. Default value: None
|
Keyword-Only Parameters
Name | Description |
---|---|
version_id
|
The version id parameter is an opaque DateTime value that, when present, specifies the version of the blob to operate on. |
audience
|
The audience to use when requesting tokens for Azure Active Directory authentication. Only has an effect when credential is of type TokenCredential. The value could be https://storage.azure.com/ (default) or https://.blob.core.windows.net. |
Returns
Type | Description |
---|---|
A Blob client. |
from_connection_string
Create BlobClient from a Connection String.
from_connection_string(conn_str: str, container_name: str, blob_name: str, snapshot: str | Dict[str, Any] | None = None, credential: str | Dict[str, str] | AzureNamedKeyCredential | AzureSasCredential | TokenCredential | None = None, **kwargs: Any) -> Self
Parameters
Name | Description |
---|---|
conn_str
Required
|
A connection string to an Azure Storage account. |
container_name
Required
|
The container name for the blob. |
blob_name
Required
|
The name of the blob with which to interact. |
snapshot
|
The optional blob snapshot on which to operate. This can be the snapshot ID string or the response returned from create_snapshot. Default value: None
|
credential
|
The credentials with which to authenticate. This is optional if the account URL already has a SAS token, or the connection string already has shared access key values. The value can be a SAS token string, an instance of a AzureSasCredential or AzureNamedKeyCredential from azure.core.credentials, an account shared access key, or an instance of a TokenCredentials class from azure.identity. Credentials provided here will take precedence over those in the connection string. If using an instance of AzureNamedKeyCredential, "name" should be the storage account name, and "key" should be the storage account key. Default value: None
|
Keyword-Only Parameters
Name | Description |
---|---|
version_id
|
The version id parameter is an opaque DateTime value that, when present, specifies the version of the blob to operate on. |
audience
|
The audience to use when requesting tokens for Azure Active Directory authentication. Only has an effect when credential is of type TokenCredential. The value could be https://storage.azure.com/ (default) or https://.blob.core.windows.net. |
Returns
Type | Description |
---|---|
A Blob client. |
get_account_information
Gets information related to the storage account in which the blob resides.
The information can also be retrieved if the user has a SAS to a container or blob. The keys in the returned dictionary include 'sku_name' and 'account_kind'.
get_account_information(**kwargs: Any) -> Dict[str, str]
Returns
Type | Description |
---|---|
A dict of account information (SKU and account type). |
get_blob_properties
Returns all user-defined metadata, standard HTTP properties, and system properties for the blob. It does not return the content of the blob.
get_blob_properties(**kwargs: Any) -> BlobProperties
Keyword-Only Parameters
Name | Description |
---|---|
lease
|
Required if the blob has an active lease. Value can be a BlobLeaseClient object or the lease ID as a string. |
version_id
|
The version id parameter is an opaque DateTime value that, when present, specifies the version of the blob to get properties. New in version 12.4.0. This keyword argument was introduced in API version '2019-12-12'. |
if_modified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has been modified since the specified time. |
if_unmodified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has not been modified since the specified date/time. |
etag
|
An ETag value, or the wildcard character (*). Used to check if the resource has changed, and act according to the condition specified by the match_condition parameter. |
match_condition
|
The match condition to use upon the etag. |
if_tags_match_condition
|
Specify a SQL where clause on blob tags to operate only on blob with a matching value.
eg. New in version 12.4.0. |
cpk
|
Encrypts the data on the service-side with the given key. Use of customer-provided keys must be done over HTTPS. As the encryption key itself is provided in the request, a secure connection must be established to transfer the key. |
timeout
|
Sets the server-side timeout for the operation in seconds. For more details see https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations. This value is not tracked or validated on the client. To configure client-side network timesouts see here. |
Returns
Type | Description |
---|---|
BlobProperties |
get_blob_tags
The Get Tags operation enables users to get tags on a blob or specific blob version, or snapshot.
New in version 12.4.0: This operation was introduced in API version '2019-12-12'.
get_blob_tags(**kwargs: Any) -> Dict[str, str]
Keyword-Only Parameters
Name | Description |
---|---|
version_id
|
The version id parameter is an opaque DateTime value that, when present, specifies the version of the blob to add tags to. |
if_tags_match_condition
|
Specify a SQL where clause on blob tags to operate only on destination blob with a matching value.
eg. |
lease
|
Required if the blob has an active lease. Value can be a BlobLeaseClient object or the lease ID as a string. |
timeout
|
Sets the server-side timeout for the operation in seconds. For more details see https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations. This value is not tracked or validated on the client. To configure client-side network timesouts see here. |
Returns
Type | Description |
---|---|
Key value pairs of blob tags. |
get_block_list
The Get Block List operation retrieves the list of blocks that have been uploaded as part of a block blob.
get_block_list(block_list_type: str = 'committed', **kwargs: Any) -> Tuple[List[BlobBlock], List[BlobBlock]]
Parameters
Name | Description |
---|---|
block_list_type
Required
|
Specifies whether to return the list of committed blocks, the list of uncommitted blocks, or both lists together. Possible values include: 'committed', 'uncommitted', 'all' |
Keyword-Only Parameters
Name | Description |
---|---|
lease
|
Required if the blob has an active lease. Value can be a BlobLeaseClient object or the lease ID as a string. |
if_tags_match_condition
|
Specify a SQL where clause on blob tags to operate only on destination blob with a matching value. New in version 12.4.0. |
timeout
|
Sets the server-side timeout for the operation in seconds. For more details see https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations. This value is not tracked or validated on the client. To configure client-side network timesouts see here. |
Returns
Type | Description |
---|---|
A tuple of two lists - committed and uncommitted blocks |
get_page_range_diff_for_managed_disk
Returns the list of valid page ranges for a managed disk or snapshot.
Note
This operation is only available for managed disk accounts.
New in version 12.2.0: This operation was introduced in API version '2019-07-07'.
get_page_range_diff_for_managed_disk(previous_snapshot_url: str, offset: int | None = None, length: int | None = None, **kwargs: Any) -> Tuple[List[Dict[str, int]], List[Dict[str, int]]]
Parameters
Name | Description |
---|---|
previous_snapshot_url
Required
|
Specifies the URL of a previous snapshot of the managed disk. The response will only contain pages that were changed between the target blob and its previous snapshot. |
offset
Required
|
Start of byte range to use for getting valid page ranges. If no length is given, all bytes after the offset will be searched. Pages must be aligned with 512-byte boundaries, the start offset must be a modulus of 512 and the length must be a modulus of 512. |
length
Required
|
Number of bytes to use for getting valid page ranges. If length is given, offset must be provided. This range will return valid page ranges from the offset start up to the specified length. Pages must be aligned with 512-byte boundaries, the start offset must be a modulus of 512 and the length must be a modulus of 512. |
Keyword-Only Parameters
Name | Description |
---|---|
lease
|
Required if the blob has an active lease. Value can be a BlobLeaseClient object or the lease ID as a string. |
if_modified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has been modified since the specified time. |
if_unmodified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has not been modified since the specified date/time. |
etag
|
An ETag value, or the wildcard character (*). Used to check if the resource has changed, and act according to the condition specified by the match_condition parameter. |
match_condition
|
The match condition to use upon the etag. |
timeout
|
Sets the server-side timeout for the operation in seconds. For more details see https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations. This value is not tracked or validated on the client. To configure client-side network timesouts see here. |
Returns
Type | Description |
---|---|
A tuple of two lists of page ranges as dictionaries with 'start' and 'end' keys. The first element are filled page ranges, the 2nd element is cleared page ranges. |
get_page_ranges
DEPRECATED: Returns the list of valid page ranges for a Page Blob or snapshot of a page blob.
get_page_ranges(offset: int | None = None, length: int | None = None, previous_snapshot_diff: str | Dict[str, Any] | None = None, **kwargs: Any) -> Tuple[List[Dict[str, int]], List[Dict[str, int]]]
Parameters
Name | Description |
---|---|
offset
Required
|
Start of byte range to use for getting valid page ranges. If no length is given, all bytes after the offset will be searched. Pages must be aligned with 512-byte boundaries, the start offset must be a modulus of 512 and the length must be a modulus of 512. |
length
Required
|
Number of bytes to use for getting valid page ranges. If length is given, offset must be provided. This range will return valid page ranges from the offset start up to the specified length. Pages must be aligned with 512-byte boundaries, the start offset must be a modulus of 512 and the length must be a modulus of 512. |
previous_snapshot_diff
Required
|
The snapshot diff parameter that contains an opaque DateTime value that specifies a previous blob snapshot to be compared against a more recent snapshot or the current blob. |
Keyword-Only Parameters
Name | Description |
---|---|
lease
|
Required if the blob has an active lease. Value can be a BlobLeaseClient object or the lease ID as a string. |
if_modified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has been modified since the specified time. |
if_unmodified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has not been modified since the specified date/time. |
etag
|
An ETag value, or the wildcard character (*). Used to check if the resource has changed, and act according to the condition specified by the match_condition parameter. |
match_condition
|
The match condition to use upon the etag. |
if_tags_match_condition
|
Specify a SQL where clause on blob tags to operate only on blob with a matching value.
eg. New in version 12.4.0. |
timeout
|
Sets the server-side timeout for the operation in seconds. For more details see https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations. This value is not tracked or validated on the client. To configure client-side network timesouts see here. |
Returns
Type | Description |
---|---|
A tuple of two lists of page ranges as dictionaries with 'start' and 'end' keys. The first element are filled page ranges, the 2nd element is cleared page ranges. |
list_page_ranges
Returns the list of valid page ranges for a Page Blob or snapshot of a page blob. If previous_snapshot is specified, the result will be a diff of changes between the target blob and the previous snapshot.
list_page_ranges(*, offset: int | None = None, length: int | None = None, previous_snapshot: str | Dict[str, Any] | None = None, **kwargs: Any) -> ItemPaged[PageRange]
Keyword-Only Parameters
Name | Description |
---|---|
offset
|
Start of byte range to use for getting valid page ranges. If no length is given, all bytes after the offset will be searched. Pages must be aligned with 512-byte boundaries, the start offset must be a modulus of 512 and the length must be a modulus of 512. |
length
|
Number of bytes to use for getting valid page ranges. If length is given, offset must be provided. This range will return valid page ranges from the offset start up to the specified length. Pages must be aligned with 512-byte boundaries, the start offset must be a modulus of 512 and the length must be a modulus of 512. |
previous_snapshot
|
A snapshot value that specifies that the response will contain only pages that were changed between target blob and previous snapshot. Changed pages include both updated and cleared pages. The target blob may be a snapshot, as long as the snapshot specified by previous_snapshot is the older of the two. |
lease
|
Required if the blob has an active lease. Value can be a BlobLeaseClient object or the lease ID as a string. |
if_modified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has been modified since the specified time. |
if_unmodified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has not been modified since the specified date/time. |
etag
|
An ETag value, or the wildcard character (*). Used to check if the resource has changed, and act according to the condition specified by the match_condition parameter. |
match_condition
|
The match condition to use upon the etag. |
if_tags_match_condition
|
Specify a SQL where clause on blob tags to operate only on blob with a matching value.
eg. New in version 12.4.0. |
results_per_page
|
The maximum number of page ranges to retrieve per API call. |
timeout
|
Sets the server-side timeout for the operation in seconds. For more details see https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations. This value is not tracked or validated on the client. To configure client-side network timesouts see here. |
Returns
Type | Description |
---|---|
An iterable (auto-paging) of PageRange. |
query_blob
Enables users to select/project on blob/or blob snapshot data by providing simple query expressions. This operations returns a BlobQueryReader, users need to use readall() or readinto() to get query data.
query_blob(query_expression: str, **kwargs: Any) -> BlobQueryReader
Parameters
Name | Description |
---|---|
query_expression
Required
|
Required. a query statement. For more details see https://learn.microsoft.com/azure/storage/blobs/query-acceleration-sql-reference. |
Keyword-Only Parameters
Name | Description |
---|---|
on_error
|
A function to be called on any processing errors returned by the service. |
blob_format
|
Optional. Defines the serialization of the data currently stored in the blob. The default is to treat the blob data as CSV data formatted in the default dialect. This can be overridden with a custom DelimitedTextDialect, or DelimitedJsonDialect or "ParquetDialect" (passed as a string or enum). These dialects can be passed through their respective classes, the QuickQueryDialect enum or as a string Note "ParquetDialect" is in preview, so some features may not work as intended. |
output_format
|
Optional. Defines the output serialization for the data stream. By default the data will be returned as it is represented in the blob (Parquet formats default to DelimitedTextDialect). By providing an output format, the blob data will be reformatted according to that profile. This value can be a DelimitedTextDialect or a DelimitedJsonDialect or ArrowDialect. These dialects can be passed through their respective classes, the QuickQueryDialect enum or as a string |
lease
|
Required if the blob has an active lease. Value can be a BlobLeaseClient object or the lease ID as a string. |
if_modified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has been modified since the specified time. |
if_unmodified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has not been modified since the specified date/time. |
etag
|
An ETag value, or the wildcard character (*). Used to check if the resource has changed, and act according to the condition specified by the match_condition parameter. |
match_condition
|
The match condition to use upon the etag. |
if_tags_match_condition
|
Specify a SQL where clause on blob tags to operate only on blob with a matching value.
eg. New in version 12.4.0. |
cpk
|
Encrypts the data on the service-side with the given key. Use of customer-provided keys must be done over HTTPS. As the encryption key itself is provided in the request, a secure connection must be established to transfer the key. |
timeout
|
Sets the server-side timeout for the operation in seconds. For more details see https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations. This value is not tracked or validated on the client. To configure client-side network timesouts see here. |
Returns
Type | Description |
---|---|
A streaming object (BlobQueryReader) |
resize_blob
Resizes a page blob to the specified size.
If the specified value is less than the current size of the blob, then all pages above the specified value are cleared.
resize_blob(size: int, **kwargs: Any) -> Dict[str, str | datetime]
Parameters
Name | Description |
---|---|
size
Required
|
Size used to resize blob. Maximum size for a page blob is up to 1 TB. The page blob size must be aligned to a 512-byte boundary. |
Keyword-Only Parameters
Name | Description |
---|---|
lease
|
Required if the blob has an active lease. Value can be a BlobLeaseClient object or the lease ID as a string. |
if_modified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has been modified since the specified time. |
if_unmodified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has not been modified since the specified date/time. |
etag
|
An ETag value, or the wildcard character (*). Used to check if the resource has changed, and act according to the condition specified by the match_condition parameter. |
match_condition
|
The match condition to use upon the etag. |
if_tags_match_condition
|
Specify a SQL where clause on blob tags to operate only on blob with a matching value.
eg. New in version 12.4.0. |
premium_page_blob_tier
|
A page blob tier value to set the blob to. The tier correlates to the size of the blob and number of allowed IOPS. This is only applicable to page blobs on premium storage accounts. |
timeout
|
Sets the server-side timeout for the operation in seconds. For more details see https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations. This value is not tracked or validated on the client. To configure client-side network timesouts see here. |
Returns
Type | Description |
---|---|
Blob-updated property dict (Etag and last modified). |
seal_append_blob
The Seal operation seals the Append Blob to make it read-only.
New in version 12.4.0.
seal_append_blob(**kwargs: Any) -> Dict[str, str | datetime | int]
Keyword-Only Parameters
Name | Description |
---|---|
appendpos_condition
|
Optional conditional header, used only for the Append Block operation. A number indicating the byte offset to compare. Append Block will succeed only if the append position is equal to this number. If it is not, the request will fail with the AppendPositionConditionNotMet error (HTTP status code 412 - Precondition Failed). |
lease
|
Required if the blob has an active lease. Value can be a BlobLeaseClient object or the lease ID as a string. |
if_modified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has been modified since the specified time. |
if_unmodified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has not been modified since the specified date/time. |
etag
|
An ETag value, or the wildcard character (*). Used to check if the resource has changed, and act according to the condition specified by the match_condition parameter. |
match_condition
|
The match condition to use upon the etag. |
timeout
|
Sets the server-side timeout for the operation in seconds. For more details see https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations. This value is not tracked or validated on the client. To configure client-side network timesouts see here. |
Returns
Type | Description |
---|---|
Blob-updated property dict (Etag, last modified, append offset, committed block count). |
set_blob_metadata
Sets user-defined metadata for the blob as one or more name-value pairs.
set_blob_metadata(metadata: Dict[str, str] | None = None, **kwargs: Any) -> Dict[str, str | datetime]
Parameters
Name | Description |
---|---|
metadata
Required
|
Dict containing name and value pairs. Each call to this operation replaces all existing metadata attached to the blob. To remove all metadata from the blob, call this operation with no metadata headers. |
Keyword-Only Parameters
Name | Description |
---|---|
lease
|
Required if the blob has an active lease. Value can be a BlobLeaseClient object or the lease ID as a string. |
if_modified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has been modified since the specified time. |
if_unmodified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has not been modified since the specified date/time. |
etag
|
An ETag value, or the wildcard character (*). Used to check if the resource has changed, and act according to the condition specified by the match_condition parameter. |
match_condition
|
The match condition to use upon the etag. |
if_tags_match_condition
|
Specify a SQL where clause on blob tags to operate only on blob with a matching value.
eg. New in version 12.4.0. |
cpk
|
Encrypts the data on the service-side with the given key. Use of customer-provided keys must be done over HTTPS. As the encryption key itself is provided in the request, a secure connection must be established to transfer the key. |
encryption_scope
|
A predefined encryption scope used to encrypt the data on the service. An encryption scope can be created using the Management API and referenced here by name. If a default encryption scope has been defined at the container, this value will override it if the container-level scope is configured to allow overrides. Otherwise an error will be raised. New in version 12.2.0. |
timeout
|
Sets the server-side timeout for the operation in seconds. For more details see https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations. This value is not tracked or validated on the client. To configure client-side network timesouts see here. |
Returns
Type | Description |
---|---|
Blob-updated property dict (Etag and last modified) |
set_blob_tags
The Set Tags operation enables users to set tags on a blob or specific blob version, but not snapshot. Each call to this operation replaces all existing tags attached to the blob. To remove all tags from the blob, call this operation with no tags set.
New in version 12.4.0: This operation was introduced in API version '2019-12-12'.
set_blob_tags(tags: Dict[str, str] | None = None, **kwargs: Any) -> Dict[str, Any]
Parameters
Name | Description |
---|---|
tags
Required
|
Name-value pairs associated with the blob as tag. Tags are case-sensitive. The tag set may contain at most 10 tags. Tag keys must be between 1 and 128 characters, and tag values must be between 0 and 256 characters. Valid tag key and value characters include: lowercase and uppercase letters, digits (0-9), space (' '), plus (+), minus (-), period (.), solidus (/), colon (:), equals (=), underscore (_) |
Keyword-Only Parameters
Name | Description |
---|---|
version_id
|
The version id parameter is an opaque DateTime value that, when present, specifies the version of the blob to add tags to. |
validate_content
|
If true, calculates an MD5 hash of the tags content. 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. |
if_tags_match_condition
|
Specify a SQL where clause on blob tags to operate only on destination blob with a matching value.
eg. |
lease
|
Required if the blob has an active lease. Value can be a BlobLeaseClient object or the lease ID as a string. |
timeout
|
Sets the server-side timeout for the operation in seconds. For more details see https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations. This value is not tracked or validated on the client. To configure client-side network timesouts see here. |
Returns
Type | Description |
---|---|
Blob-updated property dict (Etag and last modified) |
set_http_headers
Sets system properties on the blob.
If one property is set for the content_settings, all properties will be overridden.
set_http_headers(content_settings: ContentSettings | None = None, **kwargs: Any) -> Dict[str, Any]
Parameters
Name | Description |
---|---|
content_settings
Required
|
ContentSettings object used to set blob properties. Used to set content type, encoding, language, disposition, md5, and cache control. |
Keyword-Only Parameters
Name | Description |
---|---|
lease
|
Required if the blob has an active lease. Value can be a BlobLeaseClient object or the lease ID as a string. |
if_modified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has been modified since the specified time. |
if_unmodified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has not been modified since the specified date/time. |
etag
|
An ETag value, or the wildcard character (*). Used to check if the resource has changed, and act according to the condition specified by the match_condition parameter. |
match_condition
|
The match condition to use upon the etag. |
if_tags_match_condition
|
Specify a SQL where clause on blob tags to operate only on blob with a matching value.
eg. New in version 12.4.0. |
timeout
|
Sets the server-side timeout for the operation in seconds. For more details see https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations. This value is not tracked or validated on the client. To configure client-side network timesouts see here. |
Returns
Type | Description |
---|---|
Blob-updated property dict (Etag and last modified) |
set_immutability_policy
The Set Immutability Policy operation sets the immutability policy on the blob.
New in version 12.10.0: This operation was introduced in API version '2020-10-02'.
set_immutability_policy(immutability_policy: ImmutabilityPolicy, **kwargs: Any) -> Dict[str, str]
Parameters
Name | Description |
---|---|
immutability_policy
Required
|
Specifies the immutability policy of a blob, blob snapshot or blob version. New in version 12.10.0: This was introduced in API version '2020-10-02'. |
Keyword-Only Parameters
Name | Description |
---|---|
timeout
|
Sets the server-side timeout for the operation in seconds. For more details see https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations. This value is not tracked or validated on the client. To configure client-side network timesouts see here. |
Returns
Type | Description |
---|---|
Key value pairs of blob tags. |
set_legal_hold
The Set Legal Hold operation sets a legal hold on the blob.
New in version 12.10.0: This operation was introduced in API version '2020-10-02'.
set_legal_hold(legal_hold: bool, **kwargs: Any) -> Dict[str, str | datetime | bool]
Parameters
Name | Description |
---|---|
legal_hold
Required
|
Specified if a legal hold should be set on the blob. |
Keyword-Only Parameters
Name | Description |
---|---|
timeout
|
Sets the server-side timeout for the operation in seconds. For more details see https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations. This value is not tracked or validated on the client. To configure client-side network timesouts see here. |
Returns
Type | Description |
---|---|
Key value pairs of blob tags. |
set_premium_page_blob_tier
Sets the page blob tiers on the blob. This API is only supported for page blobs on premium accounts.
set_premium_page_blob_tier(premium_page_blob_tier: PremiumPageBlobTier, **kwargs: Any) -> None
Parameters
Name | Description |
---|---|
premium_page_blob_tier
Required
|
A page blob tier value to set the blob to. The tier correlates to the size of the blob and number of allowed IOPS. This is only applicable to page blobs on premium storage accounts. |
Keyword-Only Parameters
Name | Description |
---|---|
if_tags_match_condition
|
Specify a SQL where clause on blob tags to operate only on blob with a matching value.
eg. New in version 12.4.0. |
timeout
|
Sets the server-side timeout for the operation in seconds. For more details see https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations. This value is not tracked or validated on the client. To configure client-side network timesouts see here. |
lease
|
Required if the blob has an active lease. Value can be a BlobLeaseClient object or the lease ID as a string. |
Returns
Type | Description |
---|---|
set_sequence_number
Sets the blob sequence number.
set_sequence_number(sequence_number_action: str | SequenceNumberAction, sequence_number: str | None = None, **kwargs: Any) -> Dict[str, str | datetime]
Parameters
Name | Description |
---|---|
sequence_number_action
Required
|
This property indicates how the service should modify the blob's sequence number. See SequenceNumberAction for more information. |
sequence_number
Required
|
This property sets the blob's sequence number. The sequence number is a user-controlled property that you can use to track requests and manage concurrency issues. |
Keyword-Only Parameters
Name | Description |
---|---|
lease
|
Required if the blob has an active lease. Value can be a BlobLeaseClient object or the lease ID as a string. |
if_modified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has been modified since the specified time. |
if_unmodified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has not been modified since the specified date/time. |
etag
|
An ETag value, or the wildcard character (*). Used to check if the resource has changed, and act according to the condition specified by the match_condition parameter. |
match_condition
|
The match condition to use upon the etag. |
if_tags_match_condition
|
Specify a SQL where clause on blob tags to operate only on blob with a matching value.
eg. New in version 12.4.0. |
timeout
|
Sets the server-side timeout for the operation in seconds. For more details see https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations. This value is not tracked or validated on the client. To configure client-side network timesouts see here. |
Returns
Type | Description |
---|---|
Blob-updated property dict (Etag and last modified). |
set_standard_blob_tier
This operation sets the tier on a block blob.
A block blob's tier determines Hot/Cool/Archive storage type. This operation does not update the blob's ETag.
set_standard_blob_tier(standard_blob_tier: str | StandardBlobTier, **kwargs: Any) -> None
Parameters
Name | Description |
---|---|
standard_blob_tier
Required
|
Indicates the tier to be set on the blob. Options include 'Hot', 'Cool', 'Archive'. The hot tier is optimized for storing data that is accessed frequently. The cool storage tier is optimized for storing data that is infrequently accessed and stored for at least a month. The archive tier is optimized for storing data that is rarely accessed and stored for at least six months with flexible latency requirements. |
Keyword-Only Parameters
Name | Description |
---|---|
rehydrate_priority
|
Indicates the priority with which to rehydrate an archived blob |
version_id
|
The version id parameter is an opaque DateTime value that, when present, specifies the version of the blob to download. New in version 12.4.0. This keyword argument was introduced in API version '2019-12-12'. |
if_tags_match_condition
|
Specify a SQL where clause on blob tags to operate only on blob with a matching value.
eg. New in version 12.4.0. |
timeout
|
Sets the server-side timeout for the operation in seconds. For more details see https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations. This value is not tracked or validated on the client. To configure client-side network timesouts see here. |
lease
|
Required if the blob has an active lease. Value can be a BlobLeaseClient object or the lease ID as a string. |
Returns
Type | Description |
---|---|
stage_block
Creates a new block to be committed as part of a blob.
stage_block(block_id: str, data: bytes | str | Iterable | IO, length: int | None = None, **kwargs: Any) -> Dict[str, Any]
Parameters
Name | Description |
---|---|
block_id
Required
|
A string value that identifies the block. The string should be less than or equal to 64 bytes in size. For a given blob, the block_id must be the same size for each block. |
data
Required
|
The blob data. |
length
Required
|
Size of the block. |
Keyword-Only Parameters
Name | Description |
---|---|
validate_content
|
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. |
lease
|
Required if the blob has an active lease. Value can be a BlobLeaseClient object or the lease ID as a string. |
encoding
|
Defaults to UTF-8. |
cpk
|
Encrypts the data on the service-side with the given key. Use of customer-provided keys must be done over HTTPS. As the encryption key itself is provided in the request, a secure connection must be established to transfer the key. |
encryption_scope
|
A predefined encryption scope used to encrypt the data on the service. An encryption scope can be created using the Management API and referenced here by name. If a default encryption scope has been defined at the container, this value will override it if the container-level scope is configured to allow overrides. Otherwise an error will be raised. New in version 12.2.0. |
timeout
|
Sets the server-side timeout for the operation in seconds. For more details see https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations. This value is not tracked or validated on the client. To configure client-side network timesouts see here. |
Returns
Type | Description |
---|---|
Blob property dict. |
stage_block_from_url
Creates a new block to be committed as part of a blob where the contents are read from a URL.
stage_block_from_url(block_id: str, source_url: str, source_offset: int | None = None, source_length: int | None = None, source_content_md5: bytes | bytearray | None = None, **kwargs: Any) -> Dict[str, Any]
Parameters
Name | Description |
---|---|
block_id
Required
|
A string value that identifies the block. The string should be less than or equal to 64 bytes in size. For a given blob, the block_id must be the same size for each block. |
source_url
Required
|
The URL. |
source_offset
Required
|
Start of byte range to use for the block. Must be set if source length is provided. |
source_length
Required
|
The size of the block in bytes. |
source_content_md5
Required
|
Specify the md5 calculated for the range of bytes that must be read from the copy source. |
Keyword-Only Parameters
Name | Description |
---|---|
lease
|
Required if the blob has an active lease. Value can be a BlobLeaseClient object or the lease ID as a string. |
cpk
|
Encrypts the data on the service-side with the given key. Use of customer-provided keys must be done over HTTPS. As the encryption key itself is provided in the request, a secure connection must be established to transfer the key. |
encryption_scope
|
A predefined encryption scope used to encrypt the data on the service. An encryption scope can be created using the Management API and referenced here by name. If a default encryption scope has been defined at the container, this value will override it if the container-level scope is configured to allow overrides. Otherwise an error will be raised. New in version 12.2.0. |
timeout
|
Sets the server-side timeout for the operation in seconds. For more details see https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations. This value is not tracked or validated on the client. To configure client-side network timesouts see here. |
source_authorization
|
Authenticate as a service principal using a client secret to access a source blob. Ensure "bearer " is the prefix of the source_authorization string. |
Returns
Type | Description |
---|---|
Blob property dict. |
start_copy_from_url
Copies a blob from the given URL.
This operation returns a dictionary containing copy_status and copy_id, which can be used to check the status of or abort the copy operation. copy_status will be 'success' if the copy completed synchronously or 'pending' if the copy has been started asynchronously. For asynchronous copies, the status can be checked by polling the get_blob_properties method and checking the copy status. Set requires_sync to True to force the copy to be synchronous. The Blob service copies blobs on a best-effort basis.
The source blob for a copy operation may be a block blob, an append blob, or a page blob. If the destination blob already exists, it must be of the same blob type as the source blob. Any existing destination blob will be overwritten. The destination blob cannot be modified while a copy operation is in progress.
When copying from a page blob, the Blob service creates a destination page blob of the source blob's length, initially containing all zeroes. Then the source page ranges are enumerated, and non-empty ranges are copied.
For a block blob or an append blob, the Blob service creates a committed blob of zero length before returning from this operation. When copying from a block blob, all committed blocks and their block IDs are copied. Uncommitted blocks are not copied. At the end of the copy operation, the destination blob will have the same committed block count as the source.
When copying from an append blob, all committed blocks are copied. At the end of the copy operation, the destination blob will have the same committed block count as the source.
start_copy_from_url(source_url: str, metadata: Dict[str, str] | None = None, incremental_copy: bool = False, **kwargs: Any) -> Dict[str, str | datetime]
Parameters
Name | Description |
---|---|
source_url
Required
|
A URL of up to 2 KB in length that specifies a file or blob. The value should be URL-encoded as it would appear in a request URI. If the source is in another account, the source must either be public or must be authenticated via a shared access signature. If the source is public, no authentication is required. Examples: https://myaccount.blob.core.windows.net/mycontainer/myblob https://myaccount.blob.core.windows.net/mycontainer/myblob?snapshot= https://otheraccount.blob.core.windows.net/mycontainer/myblob?sastoken |
metadata
Required
|
Name-value pairs associated with the blob as metadata. If no name-value pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and metadata is not copied from the source blob or file. |
incremental_copy
Required
|
Copies the snapshot of the source page blob to a destination page blob. The snapshot is copied such that only the differential changes between the previously copied snapshot are transferred to the destination. The copied snapshots are complete copies of the original snapshot and can be read or copied from as usual. Defaults to False. |
Keyword-Only Parameters
Name | Description |
---|---|
tags
|
Name-value pairs associated with the blob as tag. Tags are case-sensitive. The tag set may contain at most 10 tags. Tag keys must be between 1 and 128 characters, and tag values must be between 0 and 256 characters. Valid tag key and value characters include: lowercase and uppercase letters, digits (0-9), space (' '), plus (+), minus (-), period (.), solidus (/), colon (:), equals (=), underscore (_). The (case-sensitive) literal "COPY" can instead be passed to copy tags from the source blob. This option is only available when incremental_copy=False and requires_sync=True. New in version 12.4.0. |
immutability_policy
|
Specifies the immutability policy of a blob, blob snapshot or blob version. New in version 12.10.0: This was introduced in API version '2020-10-02'. |
legal_hold
|
Specified if a legal hold should be set on the blob. New in version 12.10.0: This was introduced in API version '2020-10-02'. |
source_if_modified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this conditional header to copy the blob only if the source blob has been modified since the specified date/time. |
source_if_unmodified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this conditional header to copy the blob only if the source blob has not been modified since the specified date/time. |
source_etag
|
The source ETag value, or the wildcard character (*). Used to check if the resource has changed, and act according to the condition specified by the match_condition parameter. |
source_match_condition
|
The source match condition to use upon the etag. |
if_modified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this conditional header to copy the blob only if the destination blob has been modified since the specified date/time. If the destination blob has not been modified, the Blob service returns status code 412 (Precondition Failed). |
if_unmodified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this conditional header to copy the blob only if the destination blob has not been modified since the specified date/time. If the destination blob has been modified, the Blob service returns status code 412 (Precondition Failed). |
etag
|
The destination ETag value, or the wildcard character (*). Used to check if the resource has changed, and act according to the condition specified by the match_condition parameter. |
match_condition
|
The destination match condition to use upon the etag. |
destination_lease
|
The lease ID specified for this header must match the lease ID of the destination blob. If the request does not include the lease ID or it is not valid, the operation fails with status code 412 (Precondition Failed). |
source_lease
|
Specify this to perform the Copy Blob operation only if the lease ID given matches the active lease ID of the source blob. |
timeout
|
Sets the server-side timeout for the operation in seconds. For more details see https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations. This value is not tracked or validated on the client. To configure client-side network timesouts see here. |
premium_page_blob_tier
|
A page blob tier value to set the blob to. The tier correlates to the size of the blob and number of allowed IOPS. This is only applicable to page blobs on premium storage accounts. |
standard_blob_tier
|
A standard blob tier value to set the blob to. For this version of the library, this is only applicable to block blobs on standard storage accounts. |
rehydrate_priority
|
Indicates the priority with which to rehydrate an archived blob |
seal_destination_blob
|
Seal the destination append blob. This operation is only for append blob. New in version 12.4.0. |
requires_sync
|
Enforces that the service will not return a response until the copy is complete. |
source_authorization
|
Authenticate as a service principal using a client secret to access a source blob. Ensure "bearer " is the prefix of the source_authorization string. This option is only available when incremental_copy is set to False and requires_sync is set to True. New in version 12.9.0. |
encryption_scope
|
A predefined encryption scope used to encrypt the data on the sync copied blob. An encryption scope can be created using the Management API and referenced here by name. If a default encryption scope has been defined at the container, this value will override it if the container-level scope is configured to allow overrides. Otherwise an error will be raised. New in version 12.10.0. |
Returns
Type | Description |
---|---|
A dictionary of copy properties (etag, last_modified, copy_id, copy_status). |
undelete_blob
Restores soft-deleted blobs or snapshots.
Operation will only be successful if used within the specified number of days set in the delete retention policy.
If blob versioning is enabled, the base blob cannot be restored using this method. Instead use start_copy_from_url with the URL of the blob version you wish to promote to the current version.
undelete_blob(**kwargs: Any) -> None
Keyword-Only Parameters
Name | Description |
---|---|
timeout
|
Sets the server-side timeout for the operation in seconds. For more details see https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations. This value is not tracked or validated on the client. To configure client-side network timesouts see here. |
Returns
Type | Description |
---|---|
upload_blob
Creates a new blob from a data source with automatic chunking.
upload_blob(data: bytes | str | Iterable | IO[bytes], blob_type: str | BlobType = BlobType.BLOCKBLOB, length: int | None = None, metadata: Dict[str, str] | None = None, **kwargs: Any) -> Dict[str, Any]
Parameters
Name | Description |
---|---|
data
Required
|
The blob data to upload. |
blob_type
Required
|
The type of the blob. This can be either BlockBlob, PageBlob or AppendBlob. The default value is BlockBlob. |
length
Required
|
Number of bytes to read from the stream. This is optional, but should be supplied for optimal performance. |
metadata
Required
|
Name-value pairs associated with the blob as metadata. |
Keyword-Only Parameters
Name | Description |
---|---|
tags
|
Name-value pairs associated with the blob as tag. Tags are case-sensitive. The tag set may contain at most 10 tags. Tag keys must be between 1 and 128 characters, and tag values must be between 0 and 256 characters. Valid tag key and value characters include: lowercase and uppercase letters, digits (0-9), space (' '), plus (+), minus (-), period (.), solidus (/), colon (:), equals (=), underscore (_) New in version 12.4.0. |
overwrite
|
Whether the blob to be uploaded should overwrite the current data. If True, upload_blob will overwrite the existing data. If set to False, the operation will fail with ResourceExistsError. The exception to the above is with Append blob types: if set to False and the data already exists, an error will not be raised and the data will be appended to the existing blob. If set overwrite=True, then the existing append blob will be deleted, and a new one created. Defaults to False. |
content_settings
|
ContentSettings object used to set blob properties. Used to set content type, encoding, language, disposition, md5, and cache control. |
validate_content
|
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. |
lease
|
Required if the blob has an active lease. If specified, upload_blob only succeeds if the blob's lease is active and matches this ID. Value can be a BlobLeaseClient object or the lease ID as a string. |
if_modified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has been modified since the specified time. |
if_unmodified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has not been modified since the specified date/time. |
etag
|
An ETag value, or the wildcard character (*). Used to check if the resource has changed, and act according to the condition specified by the match_condition parameter. |
match_condition
|
The match condition to use upon the etag. |
if_tags_match_condition
|
Specify a SQL where clause on blob tags to operate only on blob with a matching value.
eg. New in version 12.4.0. |
premium_page_blob_tier
|
A page blob tier value to set the blob to. The tier correlates to the size of the blob and number of allowed IOPS. This is only applicable to page blobs on premium storage accounts. |
standard_blob_tier
|
A standard blob tier value to set the blob to. For this version of the library, this is only applicable to block blobs on standard storage accounts. |
immutability_policy
|
Specifies the immutability policy of a blob, blob snapshot or blob version. Currently this parameter of upload_blob() API is for BlockBlob only. New in version 12.10.0: This was introduced in API version '2020-10-02'. |
legal_hold
|
Specified if a legal hold should be set on the blob. Currently this parameter of upload_blob() API is for BlockBlob only. New in version 12.10.0: This was introduced in API version '2020-10-02'. |
maxsize_condition
|
Optional conditional header. The max length in bytes permitted for the append blob. If the Append Block operation would cause the blob to exceed that limit or if the blob size is already greater than the value specified in this header, the request will fail with MaxBlobSizeConditionNotMet error (HTTP status code 412 - Precondition Failed). |
max_concurrency
|
Maximum number of parallel connections to use when the blob size exceeds 64MB. |
cpk
|
Encrypts the data on the service-side with the given key. Use of customer-provided keys must be done over HTTPS. As the encryption key itself is provided in the request, a secure connection must be established to transfer the key. |
encryption_scope
|
A predefined encryption scope used to encrypt the data on the service. An encryption scope can be created using the Management API and referenced here by name. If a default encryption scope has been defined at the container, this value will override it if the container-level scope is configured to allow overrides. Otherwise an error will be raised. New in version 12.2.0. |
encoding
|
Defaults to UTF-8. |
progress_hook
|
A callback to track the progress of a long running upload. The signature is function(current: int, total: Optional[int]) where current is the number of bytes transferred so far, and total is the size of the blob or None if the size is unknown. |
timeout
|
Sets the server-side timeout for the operation in seconds. For more details see https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations. This value is not tracked or validated on the client. To configure client-side network timesouts see here. This method may make multiple calls to the service and the timeout will apply to each call individually. |
Returns
Type | Description |
---|---|
Blob-updated property Dict (Etag and last modified) |
upload_blob_from_url
Creates a new Block Blob where the content of the blob is read from a given URL. The content of an existing blob is overwritten with the new blob.
upload_blob_from_url(source_url: str, **kwargs: Any) -> Dict[str, Any]
Parameters
Name | Description |
---|---|
source_url
Required
|
A URL of up to 2 KB in length that specifies a file or blob. The value should be URL-encoded as it would appear in a request URI. The source must either be public or must be authenticated via a shared access signature as part of the url or using the source_authorization keyword. If the source is public, no authentication is required. Examples: https://myaccount.blob.core.windows.net/mycontainer/myblob https://myaccount.blob.core.windows.net/mycontainer/myblob?snapshot= https://otheraccount.blob.core.windows.net/mycontainer/myblob?sastoken |
Keyword-Only Parameters
Name | Description |
---|---|
overwrite
|
Whether the blob to be uploaded should overwrite the current data. If True, upload_blob will overwrite the existing data. If set to False, the operation will fail with ResourceExistsError. |
include_source_blob_properties
|
Indicates if properties from the source blob should be copied. Defaults to True. |
tags
|
Name-value pairs associated with the blob as tag. Tags are case-sensitive. The tag set may contain at most 10 tags. Tag keys must be between 1 and 128 characters, and tag values must be between 0 and 256 characters. Valid tag key and value characters include: lowercase and uppercase letters, digits (0-9), space (' '), plus (+), minus (-), period (.), solidus (/), colon (:), equals (=), underscore (_) |
source_content_md5
|
Specify the md5 that is used to verify the integrity of the source bytes. |
source_if_modified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the source resource has been modified since the specified time. |
source_if_unmodified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the source resource has not been modified since the specified date/time. |
source_etag
|
The source ETag value, or the wildcard character (*). Used to check if the resource has changed, and act according to the condition specified by the match_condition parameter. |
source_match_condition
|
The source match condition to use upon the etag. |
if_modified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has been modified since the specified time. |
if_unmodified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has not been modified since the specified date/time. |
etag
|
The destination ETag value, or the wildcard character (*). Used to check if the resource has changed, and act according to the condition specified by the match_condition parameter. |
match_condition
|
The destination match condition to use upon the etag. |
destination_lease
|
The lease ID specified for this header must match the lease ID of the destination blob. If the request does not include the lease ID or it is not valid, the operation fails with status code 412 (Precondition Failed). |
timeout
|
Sets the server-side timeout for the operation in seconds. For more details see https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations. This value is not tracked or validated on the client. To configure client-side network timesouts see here. |
content_settings
|
ContentSettings object used to set blob properties. Used to set content type, encoding, language, disposition, md5, and cache control. |
cpk
|
Encrypts the data on the service-side with the given key. Use of customer-provided keys must be done over HTTPS. As the encryption key itself is provided in the request, a secure connection must be established to transfer the key. |
encryption_scope
|
A predefined encryption scope used to encrypt the data on the service. An encryption scope can be created using the Management API and referenced here by name. If a default encryption scope has been defined at the container, this value will override it if the container-level scope is configured to allow overrides. Otherwise an error will be raised. |
standard_blob_tier
|
A standard blob tier value to set the blob to. For this version of the library, this is only applicable to block blobs on standard storage accounts. |
source_authorization
|
Authenticate as a service principal using a client secret to access a source blob. Ensure "bearer " is the prefix of the source_authorization string. |
Returns
Type | Description |
---|---|
Blob-updated property Dict (Etag and last modified) |
upload_page
The Upload Pages operation writes a range of pages to a page blob.
upload_page(page: bytes, offset: int, length: int, **kwargs: Any) -> Dict[str, str | datetime]
Parameters
Name | Description |
---|---|
page
Required
|
Content of the page. |
offset
Required
|
Start of byte range to use for writing to a section of the blob. Pages must be aligned with 512-byte boundaries, the start offset must be a modulus of 512 and the length must be a modulus of 512. |
length
Required
|
Number of bytes to use for writing to a section of the blob. Pages must be aligned with 512-byte boundaries, the start offset must be a modulus of 512 and the length must be a modulus of 512. |
Keyword-Only Parameters
Name | Description |
---|---|
lease
|
Required if the blob has an active lease. Value can be a BlobLeaseClient object or the lease ID as a string. |
validate_content
|
If true, calculates an MD5 hash of the page content. 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. |
if_sequence_number_lte
|
If the blob's sequence number is less than or equal to the specified value, the request proceeds; otherwise it fails. |
if_sequence_number_lt
|
If the blob's sequence number is less than the specified value, the request proceeds; otherwise it fails. |
if_sequence_number_eq
|
If the blob's sequence number is equal to the specified value, the request proceeds; otherwise it fails. |
if_modified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has been modified since the specified time. |
if_unmodified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has not been modified since the specified date/time. |
etag
|
An ETag value, or the wildcard character (*). Used to check if the resource has changed, and act according to the condition specified by the match_condition parameter. |
match_condition
|
The match condition to use upon the etag. |
if_tags_match_condition
|
Specify a SQL where clause on blob tags to operate only on blob with a matching value.
eg. New in version 12.4.0. |
cpk
|
Encrypts the data on the service-side with the given key. Use of customer-provided keys must be done over HTTPS. As the encryption key itself is provided in the request, a secure connection must be established to transfer the key. |
encryption_scope
|
A predefined encryption scope used to encrypt the data on the service. An encryption scope can be created using the Management API and referenced here by name. If a default encryption scope has been defined at the container, this value will override it if the container-level scope is configured to allow overrides. Otherwise an error will be raised. New in version 12.2.0. |
encoding
|
Defaults to UTF-8. |
timeout
|
Sets the server-side timeout for the operation in seconds. For more details see https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations. This value is not tracked or validated on the client. To configure client-side network timesouts see here. |
Returns
Type | Description |
---|---|
Blob-updated property dict (Etag and last modified). |
upload_pages_from_url
The Upload Pages operation writes a range of pages to a page blob where the contents are read from a URL.
upload_pages_from_url(source_url: str, offset: int, length: int, source_offset: int, **kwargs: Any) -> Dict[str, Any]
Parameters
Name | Description |
---|---|
source_url
Required
|
The URL of the source data. It can point to any Azure Blob or File, that is either public or has a shared access signature attached. |
offset
Required
|
Start of byte range to use for writing to a section of the blob. Pages must be aligned with 512-byte boundaries, the start offset must be a modulus of 512 and the length must be a modulus of 512. |
length
Required
|
Number of bytes to use for writing to a section of the blob. Pages must be aligned with 512-byte boundaries, the start offset must be a modulus of 512 and the length must be a modulus of 512. |
source_offset
Required
|
This indicates the start of the range of bytes(inclusive) that has to be taken from the copy source. The service will read the same number of bytes as the destination range (length-offset). |
Keyword-Only Parameters
Name | Description |
---|---|
source_content_md5
|
If given, the service will calculate the MD5 hash of the block content and compare against this value. |
source_if_modified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the source resource has been modified since the specified time. |
source_if_unmodified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the source resource has not been modified since the specified date/time. |
source_etag
|
The source ETag value, or the wildcard character (*). Used to check if the resource has changed, and act according to the condition specified by the match_condition parameter. |
source_match_condition
|
The source match condition to use upon the etag. |
lease
|
Required if the blob has an active lease. Value can be a BlobLeaseClient object or the lease ID as a string. |
if_sequence_number_lte
|
If the blob's sequence number is less than or equal to the specified value, the request proceeds; otherwise it fails. |
if_sequence_number_lt
|
If the blob's sequence number is less than the specified value, the request proceeds; otherwise it fails. |
if_sequence_number_eq
|
If the blob's sequence number is equal to the specified value, the request proceeds; otherwise it fails. |
if_modified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has been modified since the specified time. |
if_unmodified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has not been modified since the specified date/time. |
etag
|
The destination ETag value, or the wildcard character (*). Used to check if the resource has changed, and act according to the condition specified by the match_condition parameter. |
match_condition
|
The destination match condition to use upon the etag. |
if_tags_match_condition
|
Specify a SQL where clause on blob tags to operate only on blob with a matching value.
eg. New in version 12.4.0. |
cpk
|
Encrypts the data on the service-side with the given key. Use of customer-provided keys must be done over HTTPS. As the encryption key itself is provided in the request, a secure connection must be established to transfer the key. |
encryption_scope
|
A predefined encryption scope used to encrypt the data on the service. An encryption scope can be created using the Management API and referenced here by name. If a default encryption scope has been defined at the container, this value will override it if the container-level scope is configured to allow overrides. Otherwise an error will be raised. New in version 12.2.0. |
timeout
|
Sets the server-side timeout for the operation in seconds. For more details see https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations. This value is not tracked or validated on the client. To configure client-side network timesouts see here. |
source_authorization
|
Authenticate as a service principal using a client secret to access a source blob. Ensure "bearer " is the prefix of the source_authorization string. |
Returns
Type | Description |
---|---|
Response after uploading pages from specified URL. |
Attributes
api_version
location_mode
The location mode that the client is currently using.
By default this will be "primary". Options include "primary" and "secondary".
Returns
Type | Description |
---|---|
primary_endpoint
primary_hostname
secondary_endpoint
The full secondary endpoint URL if configured.
If not available a ValueError will be raised. To explicitly specify a secondary hostname, use the optional secondary_hostname keyword argument on instantiation.
Returns
Type | Description |
---|---|
Exceptions
Type | Description |
---|---|
secondary_hostname
The hostname of the secondary endpoint.
If not available this will be None. To explicitly specify a secondary hostname, use the optional secondary_hostname keyword argument on instantiation.
Returns
Type | Description |
---|---|
url
The full endpoint URL to this entity, including SAS token if used.
This could be either the primary endpoint, or the secondary endpoint depending on the current location_mode. :returns: The full endpoint URL to this entity, including SAS token if used. :rtype: str
Azure SDK for Python