Movatterモバイル変換


[0]ホーム

URL:


メイン コンテンツにスキップページ内ナビゲーションにスキップ

このブラウザーはサポートされなくなりました。

Microsoft Edge にアップグレードすると、最新の機能、セキュリティ更新プログラム、およびテクニカル サポートを利用できます。

Microsoft Edge をダウンロードするInternet Explorer と Microsoft Edge の詳細情報
目次フォーカス モードの終了

BlobClient Class

A client to interact with a specific blob, although that blob may not yet exist.

For more optional configuration, please clickhere.

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

NameDescription
account_url
Required

The URI to the storage account. In order to create a client given the full URI to the blob,use thefrom_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 overridea blob value specified in the blob URL.

snapshot

The optional blob snapshot on which to operate. This can be the snapshot ID stringor the response returned fromcreate_snapshot.

Default value: None
credential

The credentials with which to authenticate. This is optional if theaccount 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

  • except in the case of AzureSasCredential, where the conflicting SAS tokens will raise a ValueError.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

NameDescription
api_version

The Storage API version to use for requests. Default value is the most recent service version that iscompatible 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 to4*1024*1024, or 4MB.

max_single_put_size

If the blob size is less than or equal max_single_put_size, then the blob will beuploaded 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 to64*1024*1024, or 64MB.

min_large_block_upload_threshold

The minimum chunk size required to use the memory efficientalgorithm when uploading a block blob. Defaults to4*1024*1024+1.

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 to4*1024*1024, or 4MB.

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 to32*1024*1024, or 32MB.

max_chunk_get_size

The maximum chunk size used for downloading a blob. Defaults to4*1024*1024,or 4MB.

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 Directoryauthentication. Only has an effect when credential is of type TokenCredential. The value could behttps://storage.azure.com/ (default) orhttps://<account>.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 BlobService 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 ofblock IDs that make up the blob.

create_append_blob

Creates a new Append Blob. This operation creates a new 0-length append blob. The contentof any existing blob is overwritten with the newly initialized append blob. To add content tothe append blob, call theappend_block orappend_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 wayto 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 snapshotis taken, with a DateTime value appended to indicate the time at which thesnapshot 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 itssnapshots. 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 bloband 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 throughlist_blobs specifyinginclude=['deleted']option. Soft-deleted blob can be restored usingundelete_blob 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 mustbe used to read all the content or readinto() must be used to download the blob intoa 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 returnsFalse 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, andsystem 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 havebeen 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 snapshotof a page blob.

list_page_ranges

Returns the list of valid page ranges for a Page Blob or snapshotof a page blob. Ifprevious_snapshot is specified, the result will bea 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 alltags 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 wherethe contents are read from a URL.

start_copy_from_url

Copies a blob from the given URL.

This operation returns a dictionary containingcopy_status andcopy_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 theget_blob_properties method andchecking the copy status. Setrequires_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 thesame blob type as the source blob. Any existing destination blob will beoverwritten. The destination blob cannot be modified while a copy operationis in progress.

When copying from a page blob, the Blob service creates a destination pageblob of the source blob's length, initially containing all zeroes. Thenthe source page ranges are enumerated, and non-empty ranges are copied.

For a block blob or an append blob, the Blob service creates a committedblob of zero length before returning from this operation. When copyingfrom a block blob, all committed blocks and their block IDs are copied.Uncommitted blocks are not copied. At the end of the copy operation, thedestination blob will have the same committed block count as the source.

When copying from an append blob, all committed blocks are copied. At theend of the copy operation, the destination blob will have the same committedblock count as the source.

undelete_blob

Restores soft-deleted blobs or snapshots.

Operation will only be successful if used within the specified number of daysset in the delete retention policy.

If blob versioning is enabled, the base blob cannot be restored using thismethod. Instead usestart_copy_from_url with the URL of the blob versionyou 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 wherethe 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

NameDescription
copy_id
Required

The copy operation to abort. This can be either an ID string, or aninstance of BlobProperties.

Returns

TypeDescription

None

acquire_lease

Requests a new lease.

If the blob does not have an active lease, the BlobService 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

NameDescription
lease_duration

Specifies the duration of the lease, in seconds, or negative one(-1) for a lease that never expires. A non-infinite lease can bebetween 15 and 60 seconds. A lease duration cannot be changedusing renew or change. Default is -1 (infinite lease).

Default value: -1
lease_id

Proposed lease ID, in a GUID string format. The Blob Servicereturns 400 (Invalid request) if the proposed lease ID is notin the correct format.

Default value: None

Keyword-Only Parameters

NameDescription
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 onlyif 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 ifthe 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 thematch_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."\"tagname\"='my tag'"

New in version 12.4.0.

timeout

Sets the server-side timeout for the operation in seconds. For more details seehttps://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 timesoutsseehere.

Returns

TypeDescription

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

NameDescription
data
Required

Content of the block. This can be bytes, text, an iterable or a file-like object.

length

Size of the block in bytes.

Default value: None

Keyword-Only Parameters

NameDescription
validate_content

If true, calculates an MD5 hash of the block content. The storageservice checks the hash of the content that has arrivedwith the hash that was sent. This is primarily valuable for detectingbitflips 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 theblob.

maxsize_condition

Optional conditional header. The max length in bytes permitted forthe append blob. If the Append Block operation would cause the blobto exceed that limit or if the blob size is already greater than thevalue specified in this header, the request will fail withMaxBlobSizeConditionNotMet 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 willsucceed only if the append position is equal to this number. If itis 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 objector 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 onlyif 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 ifthe 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 thematch_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."\"tagname\"='my tag'"

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 encryptionscope can be created using the Management API and referenced here by name. If a defaultencryption scope has been defined at the container, this value will override it if thecontainer-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 seehttps://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 timesoutsseehere.

Returns

TypeDescription

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

NameDescription
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 ashared access signature attached.

source_offset

This indicates the start of the range of bytes (inclusive) that has to be taken from the copy source.

Default value: None
source_length

This indicates the end of the range of bytes that has to be taken from the copy source.

Default value: None

Keyword-Only Parameters

NameDescription
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 forthe append blob. If the Append Block operation would cause the blobto exceed that limit or if the blob size is already greater than thevalue specified in this header, the request will fail withMaxBlobSizeConditionNotMet 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 willsucceed only if the append position is equal to this number. If itis not, the request will fail with theAppendPositionConditionNotMet error(HTTP status code 412 - Precondition Failed).

lease

Required if the blob has an active lease. Value can be a BlobLeaseClient objector 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 onlyif 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 ifthe 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 thematch_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."\"tagname\"='my tag'"

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 onlyif 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 ifthe 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 thematch_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 encryptionscope can be created using the Management API and referenced here by name. If a defaultencryption scope has been defined at the container, this value will override it if thecontainer-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 seehttps://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 timesoutsseehere.

source_authorization

Authenticate as a service principal using a client secret to access a source blob. Ensure "bearer " isthe prefix of the source_authorization string.

source_token_intent
Literal['backup']

Required when source is Azure Storage Files and usingTokenCredential for authentication.This is ignored for other forms of authentication.Specifies the intent for all requests when usingTokenCredential authentication. Possible values are:

backup - Specifies requests are intended for backup/admin type operations, meaning that all file/directoryACLs are bypassed and full permissions are granted. User must also have required RBAC permission.

Returns

TypeDescription

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

NameDescription
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 offsetmust be a modulus of 512 and the length must be a modulus of512.

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 offsetmust be a modulus of 512 and the length must be a modulus of512.

Keyword-Only Parameters

NameDescription
lease

Required if the blob has an active lease. Value can be a BlobLeaseClient objector the lease ID as a string.

if_sequence_number_lte

If the blob's sequence number is less than or equal tothe specified value, the request proceeds; otherwise it fails.

if_sequence_number_lt

If the blob's sequence number is less than the specifiedvalue, the request proceeds; otherwise it fails.

if_sequence_number_eq

If the blob's sequence number is equal to the specifiedvalue, 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 onlyif 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 ifthe 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 thematch_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."\"tagname\"='my tag'"

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 seehttps://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 timesoutsseehere.

Returns

TypeDescription

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() -> None

commit_block_list

The Commit Block List operation writes a blob by specifying the list ofblock 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

NameDescription
block_list
Required

List of Blockblobs.

content_settings

ContentSettings object used to set blob properties. Used to set content type, encoding,language, disposition, md5, and cache control.

Default value: None
metadata

Name-value pairs associated with the blob as metadata.

Default value: None

Keyword-Only Parameters

NameDescription
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 objector 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 storageservice checks the hash of the content that has arrivedwith the hash that was sent. This is primarily valuable for detectingbitflips 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 theblob.

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 onlyif 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 ifthe 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 thematch_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 encryptionscope can be created using the Management API and referenced here by name. If a defaultencryption scope has been defined at the container, this value will override it if thecontainer-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 seehttps://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 timesoutsseehere.

Returns

TypeDescription

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 contentof any existing blob is overwritten with the newly initialized append blob. To add content tothe append blob, call theappend_block orappend_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

NameDescription
content_settings

ContentSettings object used to set blob properties. Used to set content type, encoding,language, disposition, md5, and cache control.

Default value: None
metadata

Name-value pairs associated with the blob as metadata.

Default value: None

Keyword-Only Parameters

NameDescription
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 objector 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 onlyif 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 ifthe 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 thematch_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 encryptionscope can be created using the Management API and referenced here by name. If a defaultencryption scope has been defined at the container, this value will override it if thecontainer-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 seehttps://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 timesoutsseehere.

Returns

TypeDescription

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

NameDescription
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

ContentSettings object used to set blob properties. Used to set content type, encoding,language, disposition, md5, and cache control.

Default value: None
metadata

Name-value pairs associated with the blob as metadata.

Default value: None
premium_page_blob_tier

A page blob tier value to set the blob to. The tier correlates to the size of theblob and number of allowed IOPS. This is only applicable to page blobs onpremium storage accounts.

Default value: None

Keyword-Only Parameters

NameDescription
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 totrack requests. The value of the sequence number must be between 0and 2^63 - 1.The default value is 0.

lease

Required if the blob has an active lease. Value can be a BlobLeaseClient objector 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 onlyif 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 ifthe 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 thematch_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 encryptionscope can be created using the Management API and referenced here by name. If a defaultencryption scope has been defined at the container, this value will override it if thecontainer-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 seehttps://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 timesoutsseehere.

Returns

TypeDescription

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 wayto 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 snapshotis taken, with a DateTime value appended to indicate the time at which thesnapshot was taken.

create_snapshot(metadata: Dict[str, str] | None = None, **kwargs: Any) -> Dict[str, str | datetime]

Parameters

NameDescription
metadata

Name-value pairs associated with the blob as metadata.

Default value: None

Keyword-Only Parameters

NameDescription
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 onlyif 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 ifthe 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 thematch_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 objector 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 encryptionscope can be created using the Management API and referenced here by name. If a defaultencryption scope has been defined at the container, this value will override it if thecontainer-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 seehttps://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 timesoutsseehere.

Returns

TypeDescription

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 itssnapshots. 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 bloband 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 throughlist_blobs specifyinginclude=['deleted']option. Soft-deleted blob can be restored usingundelete_blob operation.

delete_blob(delete_snapshots: str | None = None, **kwargs: Any) -> None

Parameters

NameDescription
delete_snapshots

Required if the blob has associated snapshots. Values include:

  • "only": Deletes only the blobs snapshots.

  • "include": Deletes the blob along with all snapshots.

Default value: None

Keyword-Only Parameters

NameDescription
version_id

The version id parameter is an opaque DateTimevalue 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 onlysucceeds if the blob's lease is active and matches this ID. Value can be aBlobLeaseClient 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 onlyif 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 ifthe 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 thematch_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."\"tagname\"='my tag'"

New in version 12.4.0.

timeout

Sets the server-side timeout for the operation in seconds. For more details seehttps://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 timesoutsseehere.

Returns

TypeDescription

None

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

NameDescription
version_id

The version id parameter is an opaque DateTimevalue 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 seehttps://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 timesoutsseehere.

Returns

TypeDescription

Key value pairs of blob tags.

download_blob

Downloads a blob to the StorageStreamDownloader. The readall() method mustbe used to read all the content or readinto() must be used to download the blob intoa 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

NameDescription
offset

Start of byte range to use for downloading a section of the blob.Must be set if length is provided.

Default value: None
length

Number of bytes to read from the stream. This is optional, butshould be supplied for optimal performance.

Default value: None

Keyword-Only Parameters

NameDescription
version_id

The version id parameter is an opaque DateTimevalue 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 storageservice checks the hash of the content that has arrived with the hashthat was sent. This is primarily valuable for detecting bitflips onthe wire if using http instead of https, as https (the default), willalready validate. Note that this MD5 hash is not stored with theblob. Also note that if enabled, the memory-efficient upload algorithmwill not be used because computing the MD5 hash requires bufferingentire 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 onlysucceeds if the blob's lease is active and matches this ID. Value can be aBlobLeaseClient 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 onlyif 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 ifthe 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 thematch_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."\"tagname\"='my tag'"

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

Maximum number of parallel connections to use when transferring the blob in chunks.This option does not affect the underlying connection pool, and mayrequire a separate configuration of the connection pool.

encoding

Encoding to decode the downloaded bytes. Default is None, i.e. no decoding.

Default value: None
progress_hook

A callback to track the progress of a long running download. The signature isfunction(current: int, total: int) where current is the number of bytes transferredso far, and total is the total size of the download.

timeout

Sets the server-side timeout for the operation in seconds. For more details seehttps://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 timesoutsseehere. This method may make multiple calls to the service andthe timeout will apply to each call individually.multiple calls to the Azure service and the timeout will apply toeach call individually.

Returns

TypeDescription

A streaming object (StorageStreamDownloader)

exists

Returns True if a blob exists with the defined parameters, and returnsFalse otherwise.

exists(**kwargs: Any) -> bool

Keyword-Only Parameters

NameDescription
version_id

The version id parameter is an opaque DateTimevalue 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 seehttps://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 timesoutsseehere.

Returns

TypeDescription

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

NameDescription
blob_url
Required

The full endpoint URL to the Blob, including SAS token and snapshot if used. This could beeither the primary endpoint, or the secondary endpoint depending on the currentlocation_mode.

credential

The credentials with which to authenticate. This is optional if theaccount URL already has a SAS token, or the connection string already has sharedaccess 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

  • except in the case of AzureSasCredential, where the conflicting SAS tokens will raise a ValueError.If using an instance of AzureNamedKeyCredential, "name" should be the storage account name, and "key"should be the storage account key.
Default value: None
snapshot

The optional blob snapshot on which to operate. This can be the snapshot ID stringor the response returned fromcreate_snapshot. If specified, this will overridethe snapshot in the url.

Default value: None

Keyword-Only Parameters

NameDescription
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 Directoryauthentication. Only has an effect when credential is of type TokenCredential. The value could behttps://storage.azure.com/ (default) orhttps://<account>.blob.core.windows.net.

Returns

TypeDescription

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

NameDescription
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 stringor the response returned fromcreate_snapshot.

Default value: None
credential

The credentials with which to authenticate. This is optional if theaccount URL already has a SAS token, or the connection string already has sharedaccess 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

NameDescription
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 Directoryauthentication. Only has an effect when credential is of type TokenCredential. The value could behttps://storage.azure.com/ (default) orhttps://<account>.blob.core.windows.net.

Returns

TypeDescription

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

TypeDescription

A dict of account information (SKU and account type).

get_blob_properties

Returns all user-defined metadata, standard HTTP properties, andsystem properties for the blob. It does not return the content of the blob.

get_blob_properties(**kwargs: Any) -> BlobProperties

Keyword-Only Parameters

NameDescription
lease

Required if the blob has an active lease. Value can be a BlobLeaseClient objector the lease ID as a string.

version_id

The version id parameter is an opaque DateTimevalue 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 onlyif 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 ifthe 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 thematch_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."\"tagname\"='my tag'"

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 seehttps://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 timesoutsseehere.

Returns

TypeDescription

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

NameDescription
version_id

The version id parameter is an opaque DateTimevalue 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."\"tagname\"='my tag'"

lease

Required if the blob has an active lease. Value can be a BlobLeaseClient objector the lease ID as a string.

timeout

Sets the server-side timeout for the operation in seconds. For more details seehttps://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 timesoutsseehere.

Returns

TypeDescription

Key value pairs of blob tags.

get_block_list

The Get Block List operation retrieves the list of blocks that havebeen uploaded as part of a block blob.

get_block_list(block_list_type: str = 'committed', **kwargs: Any) -> Tuple[List[BlobBlock], List[BlobBlock]]

Parameters

NameDescription
block_list_type

Specifies whether to return the list of committedblocks, the list of uncommitted blocks, or both lists together.Possible values include: 'committed', 'uncommitted', 'all'

Default value: committed

Keyword-Only Parameters

NameDescription
lease

Required if the blob has an active lease. Value can be a BlobLeaseClient objector 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 seehttps://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 timesoutsseehere.

Returns

TypeDescription

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

NameDescription
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 andits previous snapshot.

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 offsetmust be a modulus of 512 and the length must be a modulus of512.

Default value: None
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 tothe specified length.Pages must be aligned with 512-byte boundaries, the start offsetmust be a modulus of 512 and the length must be a modulus of512.

Default value: None

Keyword-Only Parameters

NameDescription
lease

Required if the blob has an active lease. Value can be a BlobLeaseClient objector 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 onlyif 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 ifthe 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 thematch_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 seehttps://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 timesoutsseehere.

Returns

TypeDescription

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 snapshotof 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

NameDescription
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 offsetmust be a modulus of 512 and the length must be a modulus of512.

Default value: None
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 tothe specified length.Pages must be aligned with 512-byte boundaries, the start offsetmust be a modulus of 512 and the length must be a modulus of512.

Default value: None
previous_snapshot_diff

The snapshot diff parameter that contains an opaque DateTime value thatspecifies a previous blob snapshot to be comparedagainst a more recent snapshot or the current blob.

Default value: None

Keyword-Only Parameters

NameDescription
lease

Required if the blob has an active lease. Value can be a BlobLeaseClient objector 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 onlyif 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 ifthe 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 thematch_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."\"tagname\"='my tag'"

New in version 12.4.0.

timeout

Sets the server-side timeout for the operation in seconds. For more details seehttps://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 timesoutsseehere.

Returns

TypeDescription

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 snapshotof a page blob. Ifprevious_snapshot is specified, the result will bea 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

NameDescription
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 offsetmust be a modulus of 512 and the length must be a modulus of512.

Default value: None
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 tothe specified length.Pages must be aligned with 512-byte boundaries, the start offsetmust be a modulus of 512 and the length must be a modulus of512.

Default value: None
previous_snapshot

A snapshot value that specifies that the response will contain only pages that were changedbetween target blob and previous snapshot. Changed pages include both updated and clearedpages. The target blob may be a snapshot, as long as the snapshot specified byprevious_snapshotis the older of the two.

Default value: None
lease

Required if the blob has an active lease. Value can be a BlobLeaseClient objector 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 onlyif 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 ifthe 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 thematch_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."\"tagname\"='my tag'"

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 seehttps://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 timesoutsseehere.

Returns

TypeDescription

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

NameDescription
query_expression
Required

Keyword-Only Parameters

NameDescription
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 totreat the blob data as CSV data formatted in the default dialect. This can be overridden witha 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 returnedas 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 objector 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 onlyif 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 ifthe 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 thematch_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."\"tagname\"='my tag'"

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 seehttps://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 timesoutsseehere.

Returns

TypeDescription

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

NameDescription
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

NameDescription
lease

Required if the blob has an active lease. Value can be a BlobLeaseClient objector 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 onlyif 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 ifthe 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 thematch_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."\"tagname\"='my tag'"

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 theblob and number of allowed IOPS. This is only applicable to page blobs onpremium storage accounts.

timeout

Sets the server-side timeout for the operation in seconds. For more details seehttps://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 timesoutsseehere.

Returns

TypeDescription

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

NameDescription
appendpos_condition

Optional conditional header, used only for the Append Block operation.A number indicating the byte offset to compare. Append Block willsucceed only if the append position is equal to this number. If itis 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 objector 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 onlyif 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 ifthe 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 thematch_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 seehttps://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 timesoutsseehere.

Returns

TypeDescription

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

NameDescription
metadata

Dict containing name and value pairs. Each call to this operationreplaces all existing metadata attached to the blob. To remove allmetadata from the blob, call this operation with no metadata headers.

Default value: None

Keyword-Only Parameters

NameDescription
lease

Required if the blob has an active lease. Value can be a BlobLeaseClient objector 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 onlyif 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 ifthe 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 thematch_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."\"tagname\"='my tag'"

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 encryptionscope can be created using the Management API and referenced here by name. If a defaultencryption scope has been defined at the container, this value will override it if thecontainer-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 seehttps://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 timesoutsseehere.

Returns

TypeDescription

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 alltags 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

NameDescription
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 (_)

Default value: None

Keyword-Only Parameters

NameDescription
version_id

The version id parameter is an opaque DateTimevalue 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 storageservice checks the hash of the content that has arrivedwith the hash that was sent. This is primarily valuable for detectingbitflips 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 theblob.

if_tags_match_condition

Specify a SQL where clause on blob tags to operate only on destination blob with a matching value.eg."\"tagname\"='my tag'"

lease

Required if the blob has an active lease. Value can be a BlobLeaseClient objector the lease ID as a string.

timeout

Sets the server-side timeout for the operation in seconds. For more details seehttps://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 timesoutsseehere.

Returns

TypeDescription

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

NameDescription
content_settings

ContentSettings object used to set blob properties. Used to set content type, encoding,language, disposition, md5, and cache control.

Default value: None

Keyword-Only Parameters

NameDescription
lease

Required if the blob has an active lease. Value can be a BlobLeaseClient objector 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 onlyif 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 ifthe 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 thematch_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."\"tagname\"='my tag'"

New in version 12.4.0.

timeout

Sets the server-side timeout for the operation in seconds. For more details seehttps://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 timesoutsseehere.

Returns

TypeDescription

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

NameDescription
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

NameDescription
version_id

The version id parameter is an opaque DateTimevalue 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 seehttps://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 timesoutsseehere.

Returns

TypeDescription

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

NameDescription
legal_hold
Required

Specified if a legal hold should be set on the blob.

Keyword-Only Parameters

NameDescription
version_id

The version id parameter is an opaque DateTimevalue 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 seehttps://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 timesoutsseehere.

Returns

TypeDescription

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

NameDescription
premium_page_blob_tier
Required

A page blob tier value to set the blob to. The tier correlates to the size of theblob and number of allowed IOPS. This is only applicable to page blobs onpremium storage accounts.

Keyword-Only Parameters

NameDescription
if_tags_match_condition

Specify a SQL where clause on blob tags to operate only on blob with a matching value.eg."\"tagname\"='my tag'"

New in version 12.4.0.

timeout

Sets the server-side timeout for the operation in seconds. For more details seehttps://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 timesoutsseehere.

lease

Required if the blob has an active lease. Value can be a BlobLeaseClient objector the lease ID as a string.

Returns

TypeDescription

None

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

NameDescription
sequence_number_action
Required

This property indicates how the service should modify the blob's sequencenumber. SeeSequenceNumberAction for more information.

sequence_number

This property sets the blob's sequence number. The sequence number is auser-controlled property that you can use to track requests and manageconcurrency issues.

Default value: None

Keyword-Only Parameters

NameDescription
lease

Required if the blob has an active lease. Value can be a BlobLeaseClient objector 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 onlyif 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 ifthe 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 thematch_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."\"tagname\"='my tag'"

New in version 12.4.0.

timeout

Sets the server-side timeout for the operation in seconds. For more details seehttps://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 timesoutsseehere.

Returns

TypeDescription

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

NameDescription
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 accessedfrequently. The cool storage tier is optimized for storing data thatis infrequently accessed and stored for at least a month. The archivetier is optimized for storing data that is rarely accessed and storedfor at least six months with flexible latency requirements.

Keyword-Only Parameters

NameDescription
rehydrate_priority

Indicates the priority with which to rehydrate an archived blob

version_id

The version id parameter is an opaque DateTimevalue 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."\"tagname\"='my tag'"

New in version 12.4.0.

timeout

Sets the server-side timeout for the operation in seconds. For more details seehttps://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 timesoutsseehere.

lease

Required if the blob has an active lease. Value can be a BlobLeaseClient objector the lease ID as a string.

Returns

TypeDescription

None

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

NameDescription
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

Size of the block.

Default value: None

Keyword-Only Parameters

NameDescription
validate_content

If true, calculates an MD5 hash for each chunk of the blob. The storageservice checks the hash of the content that has arrived with the hashthat was sent. This is primarily valuable for detecting bitflips onthe wire if using http instead of https, as https (the default), willalready validate. Note that this MD5 hash is not stored with theblob. Also note that if enabled, the memory-efficient upload algorithmwill not be used because computing the MD5 hash requires bufferingentire 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 objector 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 encryptionscope can be created using the Management API and referenced here by name. If a defaultencryption scope has been defined at the container, this value will override it if thecontainer-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 seehttps://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 timesoutsseehere.

Returns

TypeDescription

Blob property dict.

stage_block_from_url

Creates a new block to be committed as part of a blob wherethe 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

NameDescription
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

Start of byte range to use for the block.Must be set if source length is provided.

Default value: None
source_length

The size of the block in bytes.

Default value: None
source_content_md5

Specify the md5 calculated for the range ofbytes that must be read from the copy source.

Default value: None

Keyword-Only Parameters

NameDescription
lease

Required if the blob has an active lease. Value can be a BlobLeaseClient objector 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 encryptionscope can be created using the Management API and referenced here by name. If a defaultencryption scope has been defined at the container, this value will override it if thecontainer-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 seehttps://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 timesoutsseehere.

source_authorization

Authenticate as a service principal using a client secret to access a source blob. Ensure "bearer " isthe prefix of the source_authorization string.

source_token_intent
Literal['backup']

Required when source is Azure Storage Files and usingTokenCredential for authentication.This is ignored for other forms of authentication.Specifies the intent for all requests when usingTokenCredential authentication. Possible values are:

backup - Specifies requests are intended for backup/admin type operations, meaning that all file/directoryACLs are bypassed and full permissions are granted. User must also have required RBAC permission.

Returns

TypeDescription

Blob property dict.

start_copy_from_url

Copies a blob from the given URL.

This operation returns a dictionary containingcopy_status andcopy_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 theget_blob_properties method andchecking the copy status. Setrequires_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 thesame blob type as the source blob. Any existing destination blob will beoverwritten. The destination blob cannot be modified while a copy operationis in progress.

When copying from a page blob, the Blob service creates a destination pageblob of the source blob's length, initially containing all zeroes. Thenthe source page ranges are enumerated, and non-empty ranges are copied.

For a block blob or an append blob, the Blob service creates a committedblob of zero length before returning from this operation. When copyingfrom a block blob, all committed blocks and their block IDs are copied.Uncommitted blocks are not copied. At the end of the copy operation, thedestination blob will have the same committed block count as the source.

When copying from an append blob, all committed blocks are copied. At theend of the copy operation, the destination blob will have the same committedblock 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

NameDescription
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 publicor must be authenticated via a shared access signature. If the sourceis public, no authentication is required.Examples:https://myaccount.blob.core.windows.net/mycontainer/myblob

https://myaccount.blob.core.windows.net/mycontainer/myblob?snapshot=<DateTime>

https://otheraccount.blob.core.windows.net/mycontainer/myblob?sastoken

metadata

Name-value pairs associated with the blob as metadata. If no name-valuepairs are specified, the operation will copy the metadata from thesource blob or file to the destination blob. If one or more name-valuepairs are specified, the destination blob is created with the specifiedmetadata, and metadata is not copied from the source blob or file.

Default value: None
incremental_copy

Copies the snapshot of the source page blob to a destination page blob.The snapshot is copied such that only the differential changes betweenthe previously copied snapshot are transferred to the destination.The copied snapshots are complete copies of the original snapshot andcan be read or copied from as usual. Defaults to False.

Default value: False

Keyword-Only Parameters

NameDescription
tags
dict(str,str) orLiteral["COPY"]

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 whenincremental_copy=False andrequires_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 sourceblob 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 blobhas 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 thematch_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 onlyif the destination blob has been modified since the specified date/time.If the destination blob has not been modified, the Blob service returnsstatus 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 onlyif the destination blob has not been modified since the specifieddate/time. If the destination blob has been modified, the Blob servicereturns 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 thematch_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 thedestination blob. If the request does not include the lease ID or it is notvalid, the operation fails with status code 412 (Precondition Failed).

source_lease

Specify this to perform the Copy Blob operation only ifthe 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 seehttps://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 timesoutsseehere.

premium_page_blob_tier

A page blob tier value to set the blob to. The tier correlates to the size of theblob and number of allowed IOPS. This is only applicable to page blobs onpremium 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 " isthe prefix of the source_authorization string. This option is only available whenincremental_copy isset to False andrequires_sync is set to True.

New in version 12.9.0.

source_token_intent
Literal['backup']

Required when source is Azure Storage Files and usingTokenCredential for authentication.This is ignored for other forms of authentication.Specifies the intent for all requests when usingTokenCredential authentication. Possible values are:

backup - Specifies requests are intended for backup/admin type operations, meaning that all file/directoryACLs are bypassed and full permissions are granted. User must also have required RBAC permission.

encryption_scope

A predefined encryption scope used to encrypt the data on the sync copied blob. An encryptionscope can be created using the Management API and referenced here by name. If a defaultencryption scope has been defined at the container, this value will override it if thecontainer-level scope is configured to allow overrides. Otherwise an error will be raised.

New in version 12.10.0.

Returns

TypeDescription

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 daysset in the delete retention policy.

If blob versioning is enabled, the base blob cannot be restored using thismethod. Instead usestart_copy_from_url with the URL of the blob versionyou wish to promote to the current version.

undelete_blob(**kwargs: Any) -> None

Keyword-Only Parameters

NameDescription
timeout

Sets the server-side timeout for the operation in seconds. For more details seehttps://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 timesoutsseehere.

Returns

TypeDescription

None

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

NameDescription
data
Required

The blob data to upload.

blob_type

The type of the blob. This can beeither BlockBlob, PageBlob or AppendBlob. The default value is BlockBlob.

Default value: BlobType.BLOCKBLOB
length

Number of bytes to read from the stream. This is optional, butshould be supplied for optimal performance.

Default value: None
metadata

Name-value pairs associated with the blob as metadata.

Default value: None

Keyword-Only Parameters

NameDescription
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, theoperation will fail with ResourceExistsError. The exception to the above is with Appendblob types: if set to False and the data already exists, an error will not be raisedand the data will be appended to the existing blob. If set overwrite=True, then the existingappend 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 storageservice checks the hash of the content that has arrived with the hashthat was sent. This is primarily valuable for detecting bitflips onthe wire if using http instead of https, as https (the default), willalready validate. Note that this MD5 hash is not stored with theblob. Also note that if enabled, the memory-efficient upload algorithmwill not be used because computing the MD5 hash requires bufferingentire 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 theblob's lease is active and matches this ID. Value can be a BlobLeaseClient objector 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 onlyif 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 ifthe 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 thematch_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."\"tagname\"='my tag'"

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 theblob and number of allowed IOPS. This is only applicable to page blobs onpremium 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 forthe append blob. If the Append Block operation would cause the blobto exceed that limit or if the blob size is already greater than thevalue specified in this header, the request will fail withMaxBlobSizeConditionNotMet error (HTTP status code 412 - Precondition Failed).

max_concurrency

Maximum number of parallel connections to use when transferring the blob in chunks.This option does not affect the underlying connection pool, and mayrequire a separate configuration of the connection pool.

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 encryptionscope can be created using the Management API and referenced here by name. If a defaultencryption scope has been defined at the container, this value will override it if thecontainer-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 isfunction(current: int, total: Optional[int]) where current is the number of bytes transferredso 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 seehttps://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 timesoutsseehere. This method may make multiple calls to the service andthe timeout will apply to each call individually.

Returns

TypeDescription

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, *, metadata: Dict[str, str] | None = None, **kwargs: Any) -> Dict[str, Any]

Parameters

NameDescription
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 sharedaccess 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=<DateTime>

https://otheraccount.blob.core.windows.net/mycontainer/myblob?sastoken

Keyword-Only Parameters

NameDescription
metadata

Name-value pairs associated with the blob as metadata.

Default value: None
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, theoperation 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 onlyif 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 ifthe 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 thematch_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 onlyif 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 ifthe 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 thematch_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 thedestination blob. If the request does not include the lease ID or it is notvalid, the operation fails with status code 412 (Precondition Failed).

timeout

Sets the server-side timeout for the operation in seconds. For more details seehttps://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 timesoutsseehere.

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 encryptionscope can be created using the Management API and referenced here by name. If a defaultencryption scope has been defined at the container, this value will override it if thecontainer-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 " isthe prefix of the source_authorization string.

source_token_intent
Literal['backup']

Required when source is Azure Storage Files and usingTokenCredential for authentication.This is ignored for other forms of authentication.Specifies the intent for all requests when usingTokenCredential authentication. Possible values are:

backup - Specifies requests are intended for backup/admin type operations, meaning that all file/directoryACLs are bypassed and full permissions are granted. User must also have required RBAC permission.

Returns

TypeDescription

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

NameDescription
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 offsetmust be a modulus of 512 and the length must be a modulus of512.

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 offsetmust be a modulus of 512 and the length must be a modulus of512.

Keyword-Only Parameters

NameDescription
lease

Required if the blob has an active lease. Value can be a BlobLeaseClient objector the lease ID as a string.

validate_content

If true, calculates an MD5 hash of the page content. The storageservice checks the hash of the content that has arrivedwith the hash that was sent. This is primarily valuable for detectingbitflips 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 theblob.

if_sequence_number_lte

If the blob's sequence number is less than or equal tothe specified value, the request proceeds; otherwise it fails.

if_sequence_number_lt

If the blob's sequence number is less than the specifiedvalue, the request proceeds; otherwise it fails.

if_sequence_number_eq

If the blob's sequence number is equal to the specifiedvalue, 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 onlyif 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 ifthe 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 thematch_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."\"tagname\"='my tag'"

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 encryptionscope can be created using the Management API and referenced here by name. If a defaultencryption scope has been defined at the container, this value will override it if thecontainer-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 seehttps://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 timesoutsseehere.

Returns

TypeDescription

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 wherethe 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

NameDescription
source_url
Required

The URL of the source data. It can point to any Azure Blob or File, that is either public or has ashared 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 offsetmust be a modulus of 512 and the length must be a modulus of512.

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 offsetmust be a modulus of 512 and the length must be a modulus of512.

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

NameDescription
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 onlyif 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 ifthe 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 thematch_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 objector the lease ID as a string.

if_sequence_number_lte

If the blob's sequence number is less than or equal tothe specified value, the request proceeds; otherwise it fails.

if_sequence_number_lt

If the blob's sequence number is less than the specifiedvalue, the request proceeds; otherwise it fails.

if_sequence_number_eq

If the blob's sequence number is equal to the specifiedvalue, 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 onlyif 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 ifthe 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 thematch_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."\"tagname\"='my tag'"

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 encryptionscope can be created using the Management API and referenced here by name. If a defaultencryption scope has been defined at the container, this value will override it if thecontainer-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 seehttps://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 timesoutsseehere.

source_authorization

Authenticate as a service principal using a client secret to access a source blob. Ensure "bearer " isthe prefix of the source_authorization string.

source_token_intent
Literal['backup']

Required when source is Azure Storage Files and usingTokenCredential for authentication.This is ignored for other forms of authentication.Specifies the intent for all requests when usingTokenCredential authentication. Possible values are:

backup - Specifies requests are intended for backup/admin type operations, meaning that all file/directoryACLs are bypassed and full permissions are granted. User must also have required RBAC permission.

Returns

TypeDescription

Response after uploading pages from specified URL.

Attributes

api_version

The version of the Storage API used for requests.

Returns

TypeDescription

location_mode

The location mode that the client is currently using.

By default this will be "primary". Options include "primary" and "secondary".

Returns

TypeDescription

The current location mode.

primary_endpoint

The full primary endpoint URL.

Returns

TypeDescription

The full primary endpoint URL.

primary_hostname

The hostname of the primary endpoint.

Returns

TypeDescription

The hostname of the primary endpoint.

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 optionalsecondary_hostname keyword argument on instantiation.

Returns

TypeDescription

The full secondary endpoint URL.

Exceptions

TypeDescription

If no secondary endpoint is configured.

secondary_hostname

The hostname of the secondary endpoint.

If not available this will be None. To explicitly specify a secondary hostname, use the optionalsecondary_hostname keyword argument on instantiation.

Returns

TypeDescription

The hostname of the secondary endpoint, or None if not configured.

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 currentlocation_mode.

Returns

TypeDescription

The full endpoint URL to this entity, including SAS token if used.

GitHub で Microsoft と共同作業する
このコンテンツのソースは GitHub にあります。そこで、issue や pull request を作成および確認することもできます。 詳細については、共同作成者ガイドを参照してください。

フィードバック

このページはお役に立ちましたか?

Yesいいえ

この記事の内容

このページはお役に立ちましたか?

Yesいいえ