PageBlobService Class
Page blobs are a collection of 512-byte pages optimized for random read and write operations. To create a page blob, you initialize the page blob and specify the maximum size the page blob will grow. To add or update the contents of a page blob, you write a page or pages by specifying an offset and a range that align to 512-byte page boundaries. A write to a page blob can overwrite just one page, some pages, or up to 4 MB of the page blob. Writes to page blobs happen in-place and are immediately committed to the blob. The maximum size for a page blob is 8 TB.
:type ~azure.storage.common.TokenCredential
- Inheritance
-
PageBlobService
Constructor
PageBlobService(account_name=None, account_key=None, sas_token=None, is_emulated=False, protocol='https', endpoint_suffix='core.windows.net', custom_domain=None, request_session=None, connection_string=None, socket_timeout=None, token_credential=None)
Parameters
Name | Description |
---|---|
account_name
|
The storage account name. This is used to authenticate requests signed with an account key and to construct the storage endpoint. It is required unless a connection string is given, or if a custom domain is used with anonymous authentication. Default value: None
|
account_key
|
The storage account key. This is used for shared key authentication. If neither account key or sas token is specified, anonymous access will be used. Default value: None
|
sas_token
|
A shared access signature token to use to authenticate requests instead of the account key. If account key and sas token are both specified, account key will be used to sign. If neither are specified, anonymous access will be used. Default value: None
|
is_emulated
|
Whether to use the emulator. Defaults to False. If specified, will override all other parameters besides connection string and request session. Default value: False
|
protocol
|
The protocol to use for requests. Defaults to https. Default value: https
|
endpoint_suffix
|
The host base component of the url, minus the account name. Defaults to Azure (core.windows.net). Override this to use the China cloud (core.chinacloudapi.cn). Default value: core.windows.net
|
custom_domain
|
The custom domain to use. This can be set in the Azure Portal. For example, 'www.mydomain.com'. Default value: None
|
request_session
|
<xref:requests.Session>
The session object to use for http requests. Default value: None
|
connection_string
|
If specified, this will override all other parameters besides request session. See http://azure.microsoft.com/en-us/documentation/articles/storage-configure-connection-string/ for the connection string format. Default value: None
|
socket_timeout
|
If specified, this will override the default socket timeout. The timeout specified is in seconds. See DEFAULT_SOCKET_TIMEOUT in _constants.py for the default value. Default value: None
|
token_credential
|
A token credential used to authenticate HTTPS requests. The token value should be updated before its expiration. Default value: None
|
Variables
Name | Description |
---|---|
MAX_PAGE_SIZE
|
The size of the pages put by create_blob_from_* methods. Smaller pages may be put if there is less data provided. The maximum page size the service supports is 4MB. When using the create_blob_from_* methods, empty pages are skipped. |
Methods
abort_copy_blob |
Aborts a pending copy_blob operation, and leaves a destination blob with zero length and full metadata. |
acquire_blob_lease |
Requests a new lease. If the blob does not have an active lease, the Blob service creates a lease on the blob and returns a new lease ID. |
acquire_container_lease |
Requests a new lease. If the container does not have an active lease, the Blob service creates a lease on the container and returns a new lease ID. |
batch_delete_blobs |
Sends a batch of multiple blob delete requests. The blob delete method deletes the specified blob or snapshot. Note that deleting a blob also deletes all its snapshots. For more information, see https://docs.microsoft.com/rest/api/storageservices/delete-blob |
break_blob_lease |
Breaks the lease, if the blob has an active lease. Once a lease is broken, it cannot be renewed. Any authorized request can break the lease; the request is not required to specify a matching lease ID. When a lease is broken, the lease break period is allowed to elapse, during which time no lease operation except break and release can be performed on the blob. When a lease is successfully broken, the response indicates the interval in seconds until a new lease can be acquired. A lease that has been broken can also be released, in which case another client may immediately acquire the lease on the blob. |
break_container_lease |
Break the lease, if the container has an active lease. Once a lease is broken, it cannot be renewed. Any authorized request can break the lease; the request is not required to specify a matching lease ID. When a lease is broken, the lease break period is allowed to elapse, during which time no lease operation except break and release can be performed on the container. When a lease is successfully broken, the response indicates the interval in seconds until a new lease can be acquired. |
change_blob_lease |
Changes the lease ID of an active lease. A change must include the current lease ID and a new lease ID. |
change_container_lease |
Change the lease ID of an active lease. A change must include the current lease ID and a new lease ID. |
clear_page |
Clears a range of pages. |
copy_blob |
Copies a blob asynchronously. This operation returns a copy operation properties object, including a copy ID you can use to check or abort the copy operation. The Blob service copies blobs on a best-effort basis. The source blob for a copy operation must be a page blob. If the destination blob already exists, it must be of the same blob type as the source blob. Any existing destination blob will be overwritten. The destination blob cannot be modified while a copy operation is in progress. When copying from a page blob, the Blob service creates a destination page blob of the source blob's length, initially containing all zeroes. Then the source page ranges are enumerated, and non-empty ranges are copied. If the tier on the source blob is larger than the tier being passed to this copy operation or if the size of the blob exceeds the tier being passed to this copy operation then the operation will fail. You can call get_blob_properties on the destination blob to check the status of the copy operation. The final blob will be committed when the copy completes. |
create_blob |
Creates a new Page Blob. See create_blob_from_* for high level functions that handle the creation and upload of large blobs with automatic chunking and progress notifications. |
create_blob_from_bytes |
Creates a new blob from an array of bytes, or updates the content of an existing blob, with automatic chunking and progress notifications. Empty chunks are skipped, while non-emtpy ones(even if only partly filled) are uploaded. |
create_blob_from_path |
Creates a new blob from a file path, or updates the content of an existing blob, with automatic chunking and progress notifications. Empty chunks are skipped, while non-emtpy ones(even if only partly filled) are uploaded. |
create_blob_from_stream |
Creates a new blob from a file/stream, or updates the content of an existing blob, with automatic chunking and progress notifications. Empty chunks are skipped, while non-emtpy ones(even if only partly filled) are uploaded. |
create_container |
Creates a new container under the specified account. If the container with the same name already exists, the operation fails if fail_on_exist is True. |
delete_blob |
Marks the specified blob or snapshot for deletion. The blob is later deleted during garbage collection. Note that in order to delete a blob, you must delete all of its snapshots. You can delete both at the same time with the Delete Blob operation. If a delete retention policy is enabled for the service, then this operation soft deletes the blob or snapshot and retains the blob or snapshot for specified number of days. After specified number of days, blob's data is removed from the service during garbage collection. Soft deleted blob or snapshot is accessible through List Blobs API specifying include=Include.Deleted option. Soft-deleted blob or snapshot can be restored using Undelete API. |
delete_container |
Marks the specified container for deletion. The container and any blobs contained within it are later deleted during garbage collection. |
exists |
Returns a boolean indicating whether the container exists (if blob_name is None), or otherwise a boolean indicating whether the blob exists. |
extract_date_and_request_id | |
generate_account_shared_access_signature |
Generates a shared access signature for the blob service. Use the returned signature with the sas_token parameter of any BlobService. |
generate_blob_shared_access_signature |
Generates a shared access signature for the blob or one of its snapshots. Use the returned signature with the sas_token parameter of any BlobService. |
generate_container_shared_access_signature |
Generates a shared access signature for the container. Use the returned signature with the sas_token parameter of any BlobService. |
get_blob_account_information |
Gets information related to the storage account. The information can also be retrieved if the user has a SAS to a container or blob. |
get_blob_metadata |
Returns all user-defined metadata for the specified blob or snapshot. |
get_blob_properties |
Returns all user-defined metadata, standard HTTP properties, and system properties for the blob. It does not return the content of the blob. Returns Blob with BlobProperties and a metadata dict. |
get_blob_service_properties |
Gets the properties of a storage account's Blob service, including Azure Storage Analytics. |
get_blob_service_stats |
Retrieves statistics related to replication for the Blob service. It is only available when read-access geo-redundant replication is enabled for the storage account. With geo-redundant replication, Azure Storage maintains your data durable in two locations. In both locations, Azure Storage constantly maintains multiple healthy replicas of your data. The location where you read, create, update, or delete data is the primary storage account location. The primary location exists in the region you choose at the time you create an account via the Azure Management Azure classic portal, for example, North Central US. The location to which your data is replicated is the secondary location. The secondary location is automatically determined based on the location of the primary; it is in a second data center that resides in the same region as the primary location. Read-only access is available from the secondary location, if read-access geo-redundant replication is enabled for your storage account. |
get_blob_to_bytes |
Downloads a blob as an array of bytes, with automatic chunking and progress notifications. Returns an instance of Blob with properties, metadata, and content. |
get_blob_to_path |
Downloads a blob to a file path, with automatic chunking and progress notifications. Returns an instance of Blob with properties and metadata. |
get_blob_to_stream |
Downloads a blob to a stream, with automatic chunking and progress notifications. Returns an instance of Blob with properties and metadata. |
get_blob_to_text |
Downloads a blob as unicode text, with automatic chunking and progress notifications. Returns an instance of Blob with properties, metadata, and content. |
get_container_acl |
Gets the permissions for the specified container. The permissions indicate whether container data may be accessed publicly. |
get_container_metadata |
Returns all user-defined metadata for the specified container. |
get_container_properties |
Returns all user-defined metadata and system properties for the specified container. The data returned does not include the container's list of blobs. |
get_page_ranges |
Returns the list of valid page ranges for a Page Blob or snapshot of a page blob. |
get_page_ranges_diff |
The response will include only the pages that are different between either a recent snapshot or the current blob and a previous snapshot, including pages that were cleared. |
get_user_delegation_key |
Obtain a user delegation key for the purpose of signing SAS tokens. A token credential must be present on the service object for this request to succeed. |
incremental_copy_blob |
Copies an incremental copy of a blob asynchronously. This operation returns a copy operation properties object, including a copy ID you can use to check or abort the copy operation. The Blob service copies blobs on a best-effort basis. The source blob for an incremental copy operation must be a page blob. Call get_blob_properties on the destination blob to check the status of the copy operation. The final blob will be committed when the copy completes. |
list_blob_names |
Returns a generator to list the blob names under the specified container. The generator will lazily follow the continuation tokens returned by the service and stop when all blobs have been returned or num_results is reached. If num_results is specified and the account has more than that number of blobs, the generator will have a populated next_marker field once it finishes. This marker can be used to create a new generator if more results are desired. |
list_blobs |
Returns a generator to list the blobs under the specified container. The generator will lazily follow the continuation tokens returned by the service and stop when all blobs have been returned or num_results is reached. If num_results is specified and the account has more than that number of blobs, the generator will have a populated next_marker field once it finishes. This marker can be used to create a new generator if more results are desired. |
list_containers |
Returns a generator to list the containers under the specified account. The generator will lazily follow the continuation tokens returned by the service and stop when all containers have been returned or num_results is reached. If num_results is specified and the account has more than that number of containers, the generator will have a populated next_marker field once it finishes. This marker can be used to create a new generator if more results are desired. |
make_blob_url |
Creates the url to access a blob. |
make_container_url |
Creates the url to access a container. |
release_blob_lease |
Releases the lease. The lease may be released if the lease ID specified on the request matches that associated with the blob. Releasing the lease allows another client to immediately acquire the lease for the blob as soon as the release is complete. |
release_container_lease |
Release the lease. The lease may be released if the lease_id specified matches that associated with the container. Releasing the lease allows another client to immediately acquire the lease for the container as soon as the release is complete. |
renew_blob_lease |
Renews the lease. The lease can be renewed if the lease ID specified on the request matches that associated with the blob. Note that the lease may be renewed even if it has expired as long as the blob has not been modified or leased again since the expiration of that lease. When you renew a lease, the lease duration clock resets. |
renew_container_lease |
Renews the lease. The lease can be renewed if the lease ID specified matches that associated with the container. Note that the lease may be renewed even if it has expired as long as the container has not been leased again since the expiration of that lease. When you renew a lease, the lease duration clock resets. |
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. |
set_blob_metadata |
Sets user-defined metadata for the specified blob as one or more name-value pairs. |
set_blob_properties |
Sets system properties on the blob. If one property is set for the content_settings, all properties will be overriden. |
set_blob_service_properties |
Sets the properties of a storage account's Blob service, including Azure Storage Analytics. If an element (ex Logging) is left as None, the existing settings on the service for that functionality are preserved. |
set_container_acl |
Sets the permissions for the specified container or stored access policies that may be used with Shared Access Signatures. The permissions indicate whether blobs in a container may be accessed publicly. |
set_container_metadata |
Sets one or more user-defined name-value pairs for the specified container. Each call to this operation replaces all existing metadata attached to the container. To remove all metadata from the container, call this operation with no metadata dict. |
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_proxy |
Sets the proxy server host and port for the HTTP CONNECT Tunnelling. |
set_sequence_number |
Sets the blob sequence number. |
snapshot_blob |
Creates a read-only snapshot of a blob. |
undelete_blob |
The undelete Blob operation restores the contents and metadata of soft deleted blob or snapshot. Attempting to undelete a blob or snapshot that is not soft deleted will succeed without any changes. |
update_page |
Updates a range of pages. |
update_page_from_url |
Updates a range of pages to a page blob where the contents are read from a URL. |
abort_copy_blob
Aborts a pending copy_blob operation, and leaves a destination blob with zero length and full metadata.
abort_copy_blob(container_name, blob_name, copy_id, lease_id=None, timeout=None)
Parameters
Name | Description |
---|---|
container_name
Required
|
Name of destination container. |
blob_name
Required
|
Name of destination blob. |
copy_id
Required
|
Copy identifier provided in the copy.id of the original copy_blob operation. |
lease_id
|
Required if the destination blob has an active infinite lease. Default value: None
|
timeout
|
The timeout parameter is expressed in seconds. Default value: None
|
acquire_blob_lease
Requests a new lease. If the blob does not have an active lease, the Blob service creates a lease on the blob and returns a new lease ID.
acquire_blob_lease(container_name, blob_name, lease_duration=-1, proposed_lease_id=None, if_modified_since=None, if_unmodified_since=None, if_match=None, if_none_match=None, timeout=None)
Parameters
Name | Description |
---|---|
container_name
Required
|
Name of existing container. |
blob_name
Required
|
Name of existing blob. |
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 be between 15 and 60 seconds. A lease duration cannot be changed using renew or change. Default is -1 (infinite lease). Default value: -1
|
proposed_lease_id
|
Proposed lease ID, in a GUID string format. The Blob service returns 400 (Invalid request) if the proposed lease ID is not in the correct format. Default value: None
|
if_modified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has been modified since the specified time. Default value: None
|
if_unmodified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has not been modified since the specified date/time. Default value: None
|
if_match
|
An ETag value, or the wildcard character (*). Specify this header to perform the operation only if the resource's ETag matches the value specified. Default value: None
|
if_none_match
|
An ETag value, or the wildcard character (). Specify this header to perform the operation only if the resource's ETag does not match the value specified. Specify the wildcard character () to perform the operation only if the resource does not exist, and fail the operation if it does exist. Default value: None
|
timeout
|
The timeout parameter is expressed in seconds. Default value: None
|
Returns
Type | Description |
---|---|
str |
acquire_container_lease
Requests a new lease. If the container does not have an active lease, the Blob service creates a lease on the container and returns a new lease ID.
acquire_container_lease(container_name, lease_duration=-1, proposed_lease_id=None, if_modified_since=None, if_unmodified_since=None, timeout=None)
Parameters
Name | Description |
---|---|
container_name
Required
|
Name of existing container. |
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 be between 15 and 60 seconds. A lease duration cannot be changed using renew or change. Default is -1 (infinite lease). Default value: -1
|
proposed_lease_id
|
Proposed lease ID, in a GUID string format. The Blob service returns 400 (Invalid request) if the proposed lease ID is not in the correct format. Default value: None
|
if_modified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has been modified since the specified time. Default value: None
|
if_unmodified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has not been modified since the specified date/time. Default value: None
|
timeout
|
The timeout parameter is expressed in seconds. Default value: None
|
Returns
Type | Description |
---|---|
str |
batch_delete_blobs
Sends a batch of multiple blob delete requests.
The blob delete method deletes the specified blob or snapshot. Note that deleting a blob also deletes all its snapshots. For more information, see https://docs.microsoft.com/rest/api/storageservices/delete-blob
batch_delete_blobs(batch_delete_sub_requests, timeout=None)
Parameters
Name | Description |
---|---|
batch_delete_sub_requests
Required
|
The blob delete requests to send as a batch. |
timeout
|
The timeout parameter is expressed in seconds. Default value: None
|
Returns
Type | Description |
---|---|
parsed batch delete HTTP response |
break_blob_lease
Breaks the lease, if the blob has an active lease. Once a lease is broken, it cannot be renewed. Any authorized request can break the lease; the request is not required to specify a matching lease ID. When a lease is broken, the lease break period is allowed to elapse, during which time no lease operation except break and release can be performed on the blob. When a lease is successfully broken, the response indicates the interval in seconds until a new lease can be acquired.
A lease that has been broken can also be released, in which case another client may immediately acquire the lease on the blob.
break_blob_lease(container_name, blob_name, lease_break_period=None, if_modified_since=None, if_unmodified_since=None, if_match=None, if_none_match=None, timeout=None)
Parameters
Name | Description |
---|---|
container_name
Required
|
Name of existing container. |
blob_name
Required
|
Name of existing blob. |
lease_break_period
|
For a break operation, this is the proposed duration of seconds that the lease should continue before it is broken, between 0 and 60 seconds. This break period is only used if it is shorter than the time remaining on the lease. If longer, the time remaining on the lease is used. A new lease will not be available before the break period has expired, but the lease may be held for longer than the break period. If this header does not appear with a break operation, a fixed-duration lease breaks after the remaining lease period elapses, and an infinite lease breaks immediately. Default value: None
|
if_modified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has been modified since the specified time. Default value: None
|
if_unmodified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has not been modified since the specified date/time. Default value: None
|
if_match
|
An ETag value, or the wildcard character (*). Specify this header to perform the operation only if the resource's ETag matches the value specified. Default value: None
|
if_none_match
|
An ETag value, or the wildcard character (). Specify this header to perform the operation only if the resource's ETag does not match the value specified. Specify the wildcard character () to perform the operation only if the resource does not exist, and fail the operation if it does exist. Default value: None
|
timeout
|
The timeout parameter is expressed in seconds. Default value: None
|
Returns
Type | Description |
---|---|
int |
break_container_lease
Break the lease, if the container has an active lease. Once a lease is broken, it cannot be renewed. Any authorized request can break the lease; the request is not required to specify a matching lease ID. When a lease is broken, the lease break period is allowed to elapse, during which time no lease operation except break and release can be performed on the container. When a lease is successfully broken, the response indicates the interval in seconds until a new lease can be acquired.
break_container_lease(container_name, lease_break_period=None, if_modified_since=None, if_unmodified_since=None, timeout=None)
Parameters
Name | Description |
---|---|
container_name
Required
|
Name of existing container. |
lease_break_period
|
This is the proposed duration of seconds that the lease should continue before it is broken, between 0 and 60 seconds. This break period is only used if it is shorter than the time remaining on the lease. If longer, the time remaining on the lease is used. A new lease will not be available before the break period has expired, but the lease may be held for longer than the break period. If this header does not appear with a break operation, a fixed-duration lease breaks after the remaining lease period elapses, and an infinite lease breaks immediately. Default value: None
|
if_modified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has been modified since the specified time. Default value: None
|
if_unmodified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has not been modified since the specified date/time. Default value: None
|
timeout
|
The timeout parameter is expressed in seconds. Default value: None
|
Returns
Type | Description |
---|---|
int |
change_blob_lease
Changes the lease ID of an active lease. A change must include the current lease ID and a new lease ID.
change_blob_lease(container_name, blob_name, lease_id, proposed_lease_id, if_modified_since=None, if_unmodified_since=None, if_match=None, if_none_match=None, timeout=None)
Parameters
Name | Description |
---|---|
container_name
Required
|
Name of existing container. |
blob_name
Required
|
Name of existing blob. |
lease_id
Required
|
Required if the blob has an active lease. |
proposed_lease_id
Required
|
Proposed lease ID, in a GUID string format. The Blob service returns 400 (Invalid request) if the proposed lease ID is not in the correct format. |
if_modified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has been modified since the specified time. Default value: None
|
if_unmodified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has not been modified since the specified date/time. Default value: None
|
if_match
|
An ETag value, or the wildcard character (*). Specify this header to perform the operation only if the resource's ETag matches the value specified. Default value: None
|
if_none_match
|
An ETag value, or the wildcard character (). Specify this header to perform the operation only if the resource's ETag does not match the value specified. Specify the wildcard character () to perform the operation only if the resource does not exist, and fail the operation if it does exist. Default value: None
|
timeout
|
The timeout parameter is expressed in seconds. Default value: None
|
change_container_lease
Change the lease ID of an active lease. A change must include the current lease ID and a new lease ID.
change_container_lease(container_name, lease_id, proposed_lease_id, if_modified_since=None, if_unmodified_since=None, timeout=None)
Parameters
Name | Description |
---|---|
container_name
Required
|
Name of existing container. |
lease_id
Required
|
Lease ID for active lease. |
proposed_lease_id
Required
|
Proposed lease ID, in a GUID string format. The Blob service returns 400 (Invalid request) if the proposed lease ID is not in the correct format. |
if_modified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has been modified since the specified time. Default value: None
|
if_unmodified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has not been modified since the specified date/time. Default value: None
|
timeout
|
The timeout parameter is expressed in seconds. Default value: None
|
clear_page
Clears a range of pages.
clear_page(container_name, blob_name, start_range, end_range, lease_id=None, if_sequence_number_lte=None, if_sequence_number_lt=None, if_sequence_number_eq=None, if_modified_since=None, if_unmodified_since=None, if_match=None, if_none_match=None, timeout=None)
Parameters
Name | Description |
---|---|
container_name
Required
|
Name of existing container. |
blob_name
Required
|
Name of existing blob. |
start_range
Required
|
Start of byte range to use for writing to a section of the blob. Pages must be aligned with 512-byte boundaries, the start offset must be a modulus of 512 and the end offset must be a modulus of 512-1. Examples of valid byte ranges are 0-511, 512-1023, etc. |
end_range
Required
|
End of byte range to use for writing to a section of the blob. Pages must be aligned with 512-byte boundaries, the start offset must be a modulus of 512 and the end offset must be a modulus of 512-1. Examples of valid byte ranges are 0-511, 512-1023, etc. |
lease_id
|
Required if the blob has an active lease. Default value: None
|
if_sequence_number_lte
|
If the blob's sequence number is less than or equal to the specified value, the request proceeds; otherwise it fails. Default value: None
|
if_sequence_number_lt
|
If the blob's sequence number is less than the specified value, the request proceeds; otherwise it fails. Default value: None
|
if_sequence_number_eq
|
If the blob's sequence number is equal to the specified value, the request proceeds; otherwise it fails. Default value: None
|
if_modified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has been modified since the specified time. Default value: None
|
if_unmodified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has not been modified since the specified date/time. Default value: None
|
if_match
|
An ETag value, or the wildcard character (*). Specify an ETag value for this conditional header to write the page only if the blob's ETag value matches the value specified. If the values do not match, the Blob service fails. Default value: None
|
if_none_match
|
An ETag value, or the wildcard character (*). Specify an ETag value for this conditional header to write the page only if the blob's ETag value does not match the value specified. If the values are identical, the Blob service fails. Default value: None
|
timeout
|
The timeout parameter is expressed in seconds. Default value: None
|
Returns
Type | Description |
---|---|
ETag and last modified properties for the updated Page Blob |
copy_blob
Copies a blob asynchronously. This operation returns a copy operation properties object, including a copy ID you can use to check or abort the copy operation. The Blob service copies blobs on a best-effort basis.
The source blob for a copy operation must be a page blob. If the destination blob already exists, it must be of the same blob type as the source blob. Any existing destination blob will be overwritten. The destination blob cannot be modified while a copy operation is in progress.
When copying from a page blob, the Blob service creates a destination page blob of the source blob's length, initially containing all zeroes. Then the source page ranges are enumerated, and non-empty ranges are copied.
If the tier on the source blob is larger than the tier being passed to this copy operation or if the size of the blob exceeds the tier being passed to this copy operation then the operation will fail.
You can call get_blob_properties on the destination blob to check the status of the copy operation. The final blob will be committed when the copy completes.
copy_blob(container_name, blob_name, copy_source, metadata=None, source_if_modified_since=None, source_if_unmodified_since=None, source_if_match=None, source_if_none_match=None, destination_if_modified_since=None, destination_if_unmodified_since=None, destination_if_match=None, destination_if_none_match=None, destination_lease_id=None, source_lease_id=None, timeout=None, premium_page_blob_tier=None)
Parameters
Name | Description |
---|---|
container_name
Required
|
Name of the destination container. The container must exist. |
blob_name
Required
|
Name of the destination blob. If the destination blob exists, it will be overwritten. Otherwise, it will be created. |
copy_source
Required
|
A URL of up to 2 KB in length that specifies an Azure file or blob. The value should be URL-encoded as it would appear in a request URI. If the source is in another account, the source must either be public or must be authenticated via a shared access signature. If the source is public, no authentication is required. Examples: https://myaccount.blob.core.windows.net/mycontainer/myblob https://myaccount.blob.core.windows.net/mycontainer/myblob?snapshot= https://otheraccount.blob.core.windows.net/mycontainer/myblob?sastoken |
metadata
|
Name-value pairs associated with the blob as metadata. If no name-value pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and metadata is not copied from the source blob or file. Default value: None
|
source_if_modified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this conditional header to copy the blob only if the source blob has been modified since the specified date/time. Default value: None
|
source_if_unmodified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this conditional header to copy the blob only if the source blob has not been modified since the specified date/time. Default value: None
|
source_if_match
|
<xref:ETag>
An ETag value, or the wildcard character (*). Specify this conditional header to copy the source blob only if its ETag matches the value specified. If the ETag values do not match, the Blob service returns status code 412 (Precondition Failed). This header cannot be specified if the source is an Azure File. Default value: None
|
source_if_none_match
|
<xref:ETag>
An ETag value, or the wildcard character (*). Specify this conditional header to copy the blob only if its ETag does not match the value specified. If the values are identical, the Blob service returns status code 412 (Precondition Failed). This header cannot be specified if the source is an Azure File. Default value: None
|
destination_if_modified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this conditional header to copy the blob only if the destination blob has been modified since the specified date/time. If the destination blob has not been modified, the Blob service returns status code 412 (Precondition Failed). Default value: None
|
destination_if_unmodified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this conditional header to copy the blob only if the destination blob has not been modified since the specified date/time. If the destination blob has been modified, the Blob service returns status code 412 (Precondition Failed). Default value: None
|
destination_if_match
|
<xref:ETag>
An ETag value, or the wildcard character (*). Specify an ETag value for this conditional header to copy the blob only if the specified ETag value matches the ETag value for an existing destination blob. If the ETag for the destination blob does not match the ETag specified for If-Match, the Blob service returns status code 412 (Precondition Failed). Default value: None
|
destination_if_none_match
|
<xref:ETag>
An ETag value, or the wildcard character (). Specify an ETag value for this conditional header to copy the blob only if the specified ETag value does not match the ETag value for the destination blob. Specify the wildcard character () to perform the operation only if the destination blob does not exist. If the specified condition isn't met, the Blob service returns status code 412 (Precondition Failed). Default value: None
|
destination_lease_id
|
The lease ID specified for this header must match the lease ID of the destination blob. If the request does not include the lease ID or it is not valid, the operation fails with status code 412 (Precondition Failed). Default value: None
|
source_lease_id
|
Specify this to perform the Copy Blob operation only if the lease ID given matches the active lease ID of the source blob. Default value: None
|
timeout
|
The timeout parameter is expressed in seconds. Default value: None
|
premium_page_blob_tier
|
<xref:PageBlobTier>
A page blob tier value to set on the destination blob. The tier correlates to the size of the blob and number of allowed IOPS. This is only applicable to page blobs on premium storage accounts. If the tier on the source blob is larger than the tier being passed to this copy operation or if the size of the blob exceeds the tier being passed to this copy operation then the operation will fail. Default value: None
|
Returns
Type | Description |
---|---|
Copy operation properties such as status, source, and ID. |
create_blob
Creates a new Page Blob.
See create_blob_from_* for high level functions that handle the creation and upload of large blobs with automatic chunking and progress notifications.
create_blob(container_name, blob_name, content_length, content_settings=None, sequence_number=None, metadata=None, lease_id=None, if_modified_since=None, if_unmodified_since=None, if_match=None, if_none_match=None, timeout=None, premium_page_blob_tier=None, cpk=None)
Parameters
Name | Description |
---|---|
container_name
Required
|
Name of existing container. |
blob_name
Required
|
Name of blob to create or update. |
content_length
Required
|
Required. This header 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 properties on the blob. Default value: None
|
sequence_number
|
The sequence number is a user-controlled value that you can use to track requests. The value of the sequence number must be between 0 and 2^63 - 1.The default value is 0. Default value: None
|
metadata
|
Name-value pairs associated with the blob as metadata. Default value: None
|
lease_id
|
Required if the blob has an active lease. Default value: None
|
if_modified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has been modified since the specified time. Default value: None
|
if_unmodified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has not been modified since the specified date/time. Default value: None
|
if_match
|
An ETag value, or the wildcard character (*). Specify this header to perform the operation only if the resource's ETag matches the value specified. Default value: None
|
if_none_match
|
An ETag value, or the wildcard character (). Specify this header to perform the operation only if the resource's ETag does not match the value specified. Specify the wildcard character () to perform the operation only if the resource does not exist, and fail the operation if it does exist. Default value: None
|
timeout
|
The timeout parameter is expressed in seconds. Default value: None
|
premium_page_blob_tier
|
A page blob tier value to set the blob to. The tier correlates to the size of the blob and number of allowed IOPS. This is only applicable to page blobs on premium storage accounts. Default value: None
|
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. Default value: None
|
Returns
Type | Description |
---|---|
ETag and last modified properties for the new Page Blob |
create_blob_from_bytes
Creates a new blob from an array of bytes, or updates the content of an existing blob, with automatic chunking and progress notifications. Empty chunks are skipped, while non-emtpy ones(even if only partly filled) are uploaded.
create_blob_from_bytes(container_name, blob_name, blob, index=0, count=None, content_settings=None, metadata=None, validate_content=False, progress_callback=None, max_connections=2, lease_id=None, if_modified_since=None, if_unmodified_since=None, if_match=None, if_none_match=None, timeout=None, premium_page_blob_tier=None, cpk=None)
Parameters
Name | Description |
---|---|
container_name
Required
|
Name of existing container. |
blob_name
Required
|
Name of blob to create or update. |
blob
Required
|
Content of blob as an array of bytes. |
index
|
Start index in the byte array. Default value: 0
|
count
|
Number of bytes to upload. Set to None or negative value to upload all bytes starting from index. Default value: None
|
content_settings
|
ContentSettings object used to set blob properties. Default value: None
|
metadata
|
Name-value pairs associated with the blob as metadata. Default value: None
|
validate_content
|
If true, calculates an MD5 hash for each page of the blob. The storage service checks the hash of the content that has arrived with the hash that was sent. This is primarily valuable for detecting bitflips on the wire if using http instead of https as https (the default) will already validate. Note that this MD5 hash is not stored with the blob. Default value: False
|
progress_callback
|
<xref:func>(<xref:current>, <xref:total>)
Callback for progress with signature function(current, total) where current is the number of bytes transfered so far, and total is the size of the blob, or None if the total size is unknown. Default value: None
|
max_connections
|
Maximum number of parallel connections to use. Default value: 2
|
lease_id
|
Required if the blob has an active lease. Default value: None
|
if_modified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has been modified since the specified time. Default value: None
|
if_unmodified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has not been modified since the specified date/time. Default value: None
|
if_match
|
An ETag value, or the wildcard character (*). Specify this header to perform the operation only if the resource's ETag matches the value specified. Default value: None
|
if_none_match
|
An ETag value, or the wildcard character (). Specify this header to perform the operation only if the resource's ETag does not match the value specified. Specify the wildcard character () to perform the operation only if the resource does not exist, and fail the operation if it does exist. Default value: None
|
timeout
|
The timeout parameter is expressed in seconds. This method may make multiple calls to the Azure service and the timeout will apply to each call individually. Default value: None
|
premium_page_blob_tier
|
A page blob tier value to set the blob to. The tier correlates to the size of the blob and number of allowed IOPS. This is only applicable to page blobs on premium storage accounts. Default value: None
|
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. Default value: None
|
Returns
Type | Description |
---|---|
ETag and last modified properties for the Page Blob |
create_blob_from_path
Creates a new blob from a file path, or updates the content of an existing blob, with automatic chunking and progress notifications. Empty chunks are skipped, while non-emtpy ones(even if only partly filled) are uploaded.
create_blob_from_path(container_name, blob_name, file_path, content_settings=None, metadata=None, validate_content=False, progress_callback=None, max_connections=2, lease_id=None, if_modified_since=None, if_unmodified_since=None, if_match=None, if_none_match=None, timeout=None, premium_page_blob_tier=None, cpk=None)
Parameters
Name | Description |
---|---|
container_name
Required
|
Name of existing container. |
blob_name
Required
|
Name of blob to create or update. |
file_path
Required
|
Path of the file to upload as the blob content. |
content_settings
|
ContentSettings object used to set blob properties. Default value: None
|
metadata
|
Name-value pairs associated with the blob as metadata. Default value: None
|
validate_content
|
If true, calculates an MD5 hash for each page of the blob. The storage service checks the hash of the content that has arrived with the hash that was sent. This is primarily valuable for detecting bitflips on the wire if using http instead of https as https (the default) will already validate. Note that this MD5 hash is not stored with the blob. Default value: False
|
progress_callback
|
<xref:func>(<xref:current>, <xref:total>)
Callback for progress with signature function(current, total) where current is the number of bytes transfered so far, and total is the size of the blob, or None if the total size is unknown. Default value: None
|
max_connections
|
Maximum number of parallel connections to use. Default value: 2
|
lease_id
|
Required if the blob has an active lease. Default value: None
|
if_modified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has been modified since the specified time. Default value: None
|
if_unmodified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has not been modified since the specified date/time. Default value: None
|
if_match
|
An ETag value, or the wildcard character (*). Specify this header to perform the operation only if the resource's ETag matches the value specified. Default value: None
|
if_none_match
|
An ETag value, or the wildcard character (). Specify this header to perform the operation only if the resource's ETag does not match the value specified. Specify the wildcard character () to perform the operation only if the resource does not exist, and fail the operation if it does exist. Default value: None
|
timeout
|
The timeout parameter is expressed in seconds. This method may make multiple calls to the Azure service and the timeout will apply to each call individually. Default value: None
|
premium_page_blob_tier
|
A page blob tier value to set the blob to. The tier correlates to the size of the blob and number of allowed IOPS. This is only applicable to page blobs on premium storage accounts. Default value: None
|
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. Default value: None
|
Returns
Type | Description |
---|---|
ETag and last modified properties for the Page Blob |
create_blob_from_stream
Creates a new blob from a file/stream, or updates the content of an existing blob, with automatic chunking and progress notifications. Empty chunks are skipped, while non-emtpy ones(even if only partly filled) are uploaded.
create_blob_from_stream(container_name, blob_name, stream, count, content_settings=None, metadata=None, validate_content=False, progress_callback=None, max_connections=2, lease_id=None, if_modified_since=None, if_unmodified_since=None, if_match=None, if_none_match=None, timeout=None, premium_page_blob_tier=None, cpk=None)
Parameters
Name | Description |
---|---|
container_name
Required
|
Name of existing container. |
blob_name
Required
|
Name of blob to create or update. |
stream
Required
|
Opened file/stream to upload as the blob content. |
count
Required
|
Number of bytes to read from the stream. This is required, a page blob cannot be created if the count is unknown. |
content_settings
|
ContentSettings object used to set the blob properties. Default value: None
|
metadata
|
Name-value pairs associated with the blob as metadata. Default value: None
|
validate_content
|
If true, calculates an MD5 hash for each page of the blob. The storage service checks the hash of the content that has arrived with the hash that was sent. This is primarily valuable for detecting bitflips on the wire if using http instead of https as https (the default) will already validate. Note that this MD5 hash is not stored with the blob. Default value: False
|
progress_callback
|
<xref:func>(<xref:current>, <xref:total>)
Callback for progress with signature function(current, total) where current is the number of bytes transfered so far, and total is the size of the blob, or None if the total size is unknown. Default value: None
|
max_connections
|
Maximum number of parallel connections to use. Note that parallel upload requires the stream to be seekable. Default value: 2
|
lease_id
|
Required if the blob has an active lease. Default value: None
|
if_modified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has been modified since the specified time. Default value: None
|
if_unmodified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has not been modified since the specified date/time. Default value: None
|
if_match
|
An ETag value, or the wildcard character (*). Specify this header to perform the operation only if the resource's ETag matches the value specified. Default value: None
|
if_none_match
|
An ETag value, or the wildcard character (). Specify this header to perform the operation only if the resource's ETag does not match the value specified. Specify the wildcard character () to perform the operation only if the resource does not exist, and fail the operation if it does exist. Default value: None
|
timeout
|
The timeout parameter is expressed in seconds. This method may make multiple calls to the Azure service and the timeout will apply to each call individually. Default value: None
|
premium_page_blob_tier
|
A page blob tier value to set the blob to. The tier correlates to the size of the blob and number of allowed IOPS. This is only applicable to page blobs on premium storage accounts. Default value: None
|
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. Default value: None
|
Returns
Type | Description |
---|---|
ETag and last modified properties for the Page Blob |
create_container
Creates a new container under the specified account. If the container with the same name already exists, the operation fails if fail_on_exist is True.
create_container(container_name, metadata=None, public_access=None, fail_on_exist=False, timeout=None)
Parameters
Name | Description |
---|---|
container_name
Required
|
Name of container to create. The container name may only contain lowercase letters, numbers, and hyphens, and must begin with a letter or a number. Each hyphen must be preceded and followed by a non-hyphen character. The name must also be between 3 and 63 characters long. |
metadata
|
A dict with name_value pairs to associate with the container as metadata. Example:{'Category':'test'} Default value: None
|
public_access
|
Possible values include: container, blob. Default value: None
|
fail_on_exist
|
Specify whether to throw an exception when the container exists. Default value: False
|
timeout
|
The timeout parameter is expressed in seconds. Default value: None
|
Returns
Type | Description |
---|---|
True if container is created, False if container already exists. |
delete_blob
Marks the specified blob or snapshot for deletion. The blob is later deleted during garbage collection.
Note that in order to delete a blob, you must delete all of its snapshots. You can delete both at the same time with the Delete Blob operation.
If a delete retention policy is enabled for the service, then this operation soft deletes the blob or snapshot and retains the blob or snapshot for specified number of days. After specified number of days, blob's data is removed from the service during garbage collection. Soft deleted blob or snapshot is accessible through List Blobs API specifying include=Include.Deleted option. Soft-deleted blob or snapshot can be restored using Undelete API.
delete_blob(container_name, blob_name, snapshot=None, lease_id=None, delete_snapshots=None, if_modified_since=None, if_unmodified_since=None, if_match=None, if_none_match=None, timeout=None)
Parameters
Name | Description |
---|---|
container_name
Required
|
Name of existing container. |
blob_name
Required
|
Name of existing blob. |
snapshot
|
The snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to delete. Default value: None
|
lease_id
|
Required if the blob has an active lease. Default value: None
|
delete_snapshots
|
Required if the blob has associated snapshots. Default value: None
|
if_modified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has been modified since the specified time. Default value: None
|
if_unmodified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has not been modified since the specified date/time. Default value: None
|
if_match
|
An ETag value, or the wildcard character (*). Specify this header to perform the operation only if the resource's ETag matches the value specified. Default value: None
|
if_none_match
|
An ETag value, or the wildcard character (). Specify this header to perform the operation only if the resource's ETag does not match the value specified. Specify the wildcard character () to perform the operation only if the resource does not exist, and fail the operation if it does exist. Default value: None
|
timeout
|
The timeout parameter is expressed in seconds. Default value: None
|
delete_container
Marks the specified container for deletion. The container and any blobs contained within it are later deleted during garbage collection.
delete_container(container_name, fail_not_exist=False, lease_id=None, if_modified_since=None, if_unmodified_since=None, timeout=None)
Parameters
Name | Description |
---|---|
container_name
Required
|
Name of container to delete. |
fail_not_exist
|
Specify whether to throw an exception when the container doesn't exist. Default value: False
|
lease_id
|
If specified, delete_container only succeeds if the container's lease is active and matches this ID. Required if the container has an active lease. Default value: None
|
if_modified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has been modified since the specified time. Default value: None
|
if_unmodified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has not been modified since the specified date/time. Default value: None
|
timeout
|
The timeout parameter is expressed in seconds. Default value: None
|
Returns
Type | Description |
---|---|
True if container is deleted, False container doesn't exist. |
exists
Returns a boolean indicating whether the container exists (if blob_name is None), or otherwise a boolean indicating whether the blob exists.
exists(container_name, blob_name=None, snapshot=None, timeout=None)
Parameters
Name | Description |
---|---|
container_name
Required
|
Name of a container. |
blob_name
|
Name of a blob. If None, the container will be checked for existence. Default value: None
|
snapshot
|
The snapshot parameter is an opaque DateTime value that, when present, specifies the snapshot. Default value: None
|
timeout
|
The timeout parameter is expressed in seconds. Default value: None
|
Returns
Type | Description |
---|---|
A boolean indicating whether the resource exists. |
extract_date_and_request_id
static extract_date_and_request_id(retry_context)
Parameters
Name | Description |
---|---|
retry_context
Required
|
|
generate_account_shared_access_signature
Generates a shared access signature for the blob service. Use the returned signature with the sas_token parameter of any BlobService.
generate_account_shared_access_signature(resource_types, permission, expiry, start=None, ip=None, protocol=None)
Parameters
Name | Description |
---|---|
resource_types
Required
|
<xref:ResourceTypes>
Specifies the resource types that are accessible with the account SAS. |
permission
Required
|
<xref:AccountPermissions>
The permissions associated with the shared access signature. The user is restricted to operations allowed by the permissions. Required unless an id is given referencing a stored access policy which contains this field. This field must be omitted if it has been specified in an associated stored access policy. |
expiry
Required
|
The time at which the shared access signature becomes invalid. Required unless an id is given referencing a stored access policy which contains this field. This field must be omitted if it has been specified in an associated stored access policy. Azure will always convert values to UTC. If a date is passed in without timezone info, it is assumed to be UTC. |
start
|
The time at which the shared access signature becomes valid. If omitted, start time for this call is assumed to be the time when the storage service receives the request. Azure will always convert values to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Default value: None
|
ip
|
Specifies an IP address or a range of IP addresses from which to accept requests. If the IP address from which the request originates does not match the IP address or address range specified on the SAS token, the request is not authenticated. For example, specifying sip=168.1.5.65 or sip=168.1.5.60-168.1.5.70 on the SAS restricts the request to those IP addresses. Default value: None
|
protocol
|
Specifies the protocol permitted for a request made. The default value is https,http. See Protocol for possible values. Default value: None
|
Returns
Type | Description |
---|---|
A Shared Access Signature (sas) token. |
generate_blob_shared_access_signature
Generates a shared access signature for the blob or one of its snapshots. Use the returned signature with the sas_token parameter of any BlobService.
generate_blob_shared_access_signature(container_name, blob_name, snapshot=None, permission=None, expiry=None, start=None, id=None, ip=None, protocol=None, cache_control=None, content_disposition=None, content_encoding=None, content_language=None, content_type=None, user_delegation_key=None)
Parameters
Name | Description |
---|---|
container_name
Required
|
Name of container. |
blob_name
Required
|
Name of blob. |
snapshot
|
The snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to grant permission. Default value: None
|
permission
|
The permissions associated with the shared access signature. The user is restricted to operations allowed by the permissions. Permissions must be ordered read, write, delete, list. Required unless an id is given referencing a stored access policy which contains this field. This field must be omitted if it has been specified in an associated stored access policy. Default value: None
|
expiry
|
The time at which the shared access signature becomes invalid. Required unless an id is given referencing a stored access policy which contains this field. This field must be omitted if it has been specified in an associated stored access policy. Azure will always convert values to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Default value: None
|
start
|
The time at which the shared access signature becomes valid. If omitted, start time for this call is assumed to be the time when the storage service receives the request. Azure will always convert values to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Default value: None
|
id
|
A unique value up to 64 characters in length that correlates to a stored access policy. To create a stored access policy, use set_container_acl. Default value: None
|
ip
|
Specifies an IP address or a range of IP addresses from which to accept requests. If the IP address from which the request originates does not match the IP address or address range specified on the SAS token, the request is not authenticated. For example, specifying sip=168.1.5.65 or sip=168.1.5.60-168.1.5.70 on the SAS restricts the request to those IP addresses. Default value: None
|
protocol
|
Specifies the protocol permitted for a request made. The default value is https,http. See Protocol for possible values. Default value: None
|
cache_control
|
Response header value for Cache-Control when resource is accessed using this shared access signature. Default value: None
|
content_disposition
|
Response header value for Content-Disposition when resource is accessed using this shared access signature. Default value: None
|
content_encoding
|
Response header value for Content-Encoding when resource is accessed using this shared access signature. Default value: None
|
content_language
|
Response header value for Content-Language when resource is accessed using this shared access signature. Default value: None
|
content_type
|
Response header value for Content-Type when resource is accessed using this shared access signature. Default value: None
|
user_delegation_key
|
Instead of an account key, the user could pass in a user delegation key. A user delegation key can be obtained from the service by authenticating with an AAD identity; this can be accomplished by calling get_user_delegation_key. When present, the SAS is signed with the user delegation key instead. Default value: None
|
Returns
Type | Description |
---|---|
A Shared Access Signature (sas) token. |
generate_container_shared_access_signature
Generates a shared access signature for the container. Use the returned signature with the sas_token parameter of any BlobService.
generate_container_shared_access_signature(container_name, permission=None, expiry=None, start=None, id=None, ip=None, protocol=None, cache_control=None, content_disposition=None, content_encoding=None, content_language=None, content_type=None, user_delegation_key=None)
Parameters
Name | Description |
---|---|
container_name
Required
|
Name of container. |
permission
|
The permissions associated with the shared access signature. The user is restricted to operations allowed by the permissions. Permissions must be ordered read, write, delete, list. Required unless an id is given referencing a stored access policy which contains this field. This field must be omitted if it has been specified in an associated stored access policy. Default value: None
|
expiry
|
The time at which the shared access signature becomes invalid. Required unless an id is given referencing a stored access policy which contains this field. This field must be omitted if it has been specified in an associated stored access policy. Azure will always convert values to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Default value: None
|
start
|
The time at which the shared access signature becomes valid. If omitted, start time for this call is assumed to be the time when the storage service receives the request. Azure will always convert values to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Default value: None
|
id
|
A unique value up to 64 characters in length that correlates to a stored access policy. To create a stored access policy, use set_blob_service_properties. Default value: None
|
ip
|
Specifies an IP address or a range of IP addresses from which to accept requests. If the IP address from which the request originates does not match the IP address or address range specified on the SAS token, the request is not authenticated. For example, specifying sip=168.1.5.65 or sip=168.1.5.60-168.1.5.70 on the SAS restricts the request to those IP addresses. Default value: None
|
protocol
|
Specifies the protocol permitted for a request made. The default value is https,http. See Protocol for possible values. Default value: None
|
cache_control
|
Response header value for Cache-Control when resource is accessed using this shared access signature. Default value: None
|
content_disposition
|
Response header value for Content-Disposition when resource is accessed using this shared access signature. Default value: None
|
content_encoding
|
Response header value for Content-Encoding when resource is accessed using this shared access signature. Default value: None
|
content_language
|
Response header value for Content-Language when resource is accessed using this shared access signature. Default value: None
|
content_type
|
Response header value for Content-Type when resource is accessed using this shared access signature. Default value: None
|
user_delegation_key
|
Instead of an account key, the user could pass in a user delegation key. A user delegation key can be obtained from the service by authenticating with an AAD identity; this can be accomplished by calling get_user_delegation_key. When present, the SAS is signed with the user delegation key instead. Default value: None
|
Returns
Type | Description |
---|---|
A Shared Access Signature (sas) token. |
get_blob_account_information
Gets information related to the storage account. The information can also be retrieved if the user has a SAS to a container or blob.
get_blob_account_information(container_name=None, blob_name=None, timeout=None)
Parameters
Name | Description |
---|---|
container_name
|
Name of existing container. Optional, unless using a SAS token to a specific container or blob, in which case it's required. Default value: None
|
blob_name
|
Name of existing blob. Optional, unless using a SAS token to a specific blob, in which case it's required. Default value: None
|
timeout
|
The timeout parameter is expressed in seconds. Default value: None
|
Returns
Type | Description |
---|---|
The AccountInformation. |
get_blob_metadata
Returns all user-defined metadata for the specified blob or snapshot.
get_blob_metadata(container_name, blob_name, snapshot=None, lease_id=None, if_modified_since=None, if_unmodified_since=None, if_match=None, if_none_match=None, timeout=None, cpk=None)
Parameters
Name | Description |
---|---|
container_name
Required
|
Name of existing container. |
blob_name
Required
|
Name of existing blob. |
snapshot
|
The snapshot parameter is an opaque value that, when present, specifies the blob snapshot to retrieve. Default value: None
|
lease_id
|
Required if the blob has an active lease. Default value: None
|
if_modified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has been modified since the specified time. Default value: None
|
if_unmodified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has not been modified since the specified date/time. Default value: None
|
if_match
|
An ETag value, or the wildcard character (*). Specify this header to perform the operation only if the resource's ETag matches the value specified. Default value: None
|
if_none_match
|
An ETag value, or the wildcard character (). Specify this header to perform the operation only if the resource's ETag does not match the value specified. Specify the wildcard character () to perform the operation only if the resource does not exist, and fail the operation if it does exist. Default value: None
|
cpk
|
Decrypts 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. Default value: None
|
timeout
|
The timeout parameter is expressed in seconds. Default value: None
|
Returns
Type | Description |
---|---|
A dictionary representing the blob metadata name, value pairs. |
get_blob_properties
Returns all user-defined metadata, standard HTTP properties, and system properties for the blob. It does not return the content of the blob. Returns Blob with BlobProperties and a metadata dict.
get_blob_properties(container_name, blob_name, snapshot=None, lease_id=None, if_modified_since=None, if_unmodified_since=None, if_match=None, if_none_match=None, timeout=None, cpk=None)
Parameters
Name | Description |
---|---|
container_name
Required
|
Name of existing container. |
blob_name
Required
|
Name of existing blob. |
snapshot
|
The snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to retrieve. Default value: None
|
lease_id
|
Required if the blob has an active lease. Default value: None
|
if_modified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has been modified since the specified time. Default value: None
|
if_unmodified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has not been modified since the specified date/time. Default value: None
|
if_match
|
An ETag value, or the wildcard character (*). Specify this header to perform the operation only if the resource's ETag matches the value specified. Default value: None
|
if_none_match
|
An ETag value, or the wildcard character (). Specify this header to perform the operation only if the resource's ETag does not match the value specified. Specify the wildcard character () to perform the operation only if the resource does not exist, and fail the operation if it does exist. Default value: None
|
cpk
|
Decrypts 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. Default value: None
|
timeout
|
The timeout parameter is expressed in seconds. Default value: None
|
Returns
Type | Description |
---|---|
a blob object including properties and metadata. |
get_blob_service_properties
Gets the properties of a storage account's Blob service, including Azure Storage Analytics.
get_blob_service_properties(timeout=None)
Parameters
Name | Description |
---|---|
timeout
|
The timeout parameter is expressed in seconds. Default value: None
|
Returns
Type | Description |
---|---|
The blob ServiceProperties with an attached target_version property. |
get_blob_service_stats
Retrieves statistics related to replication for the Blob service. It is only available when read-access geo-redundant replication is enabled for the storage account.
With geo-redundant replication, Azure Storage maintains your data durable in two locations. In both locations, Azure Storage constantly maintains multiple healthy replicas of your data. The location where you read, create, update, or delete data is the primary storage account location. The primary location exists in the region you choose at the time you create an account via the Azure Management Azure classic portal, for example, North Central US. The location to which your data is replicated is the secondary location. The secondary location is automatically determined based on the location of the primary; it is in a second data center that resides in the same region as the primary location. Read-only access is available from the secondary location, if read-access geo-redundant replication is enabled for your storage account.
get_blob_service_stats(timeout=None)
Parameters
Name | Description |
---|---|
timeout
|
The timeout parameter is expressed in seconds. Default value: None
|
Returns
Type | Description |
---|---|
The blob service stats. |
get_blob_to_bytes
Downloads a blob as an array of bytes, with automatic chunking and progress notifications. Returns an instance of Blob with properties, metadata, and content.
get_blob_to_bytes(container_name, blob_name, snapshot=None, start_range=None, end_range=None, validate_content=False, progress_callback=None, max_connections=2, lease_id=None, if_modified_since=None, if_unmodified_since=None, if_match=None, if_none_match=None, timeout=None, cpk=None)
Parameters
Name | Description |
---|---|
container_name
Required
|
Name of existing container. |
blob_name
Required
|
Name of existing blob. |
snapshot
|
The snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to retrieve. Default value: None
|
start_range
|
Start of byte range to use for downloading a section of the blob. If no end_range is given, all bytes after the start_range will be downloaded. The start_range and end_range params are inclusive. Ex: start_range=0, end_range=511 will download first 512 bytes of blob. Default value: None
|
end_range
|
End of byte range to use for downloading a section of the blob. If end_range is given, start_range must be provided. The start_range and end_range params are inclusive. Ex: start_range=0, end_range=511 will download first 512 bytes of blob. Default value: None
|
validate_content
|
If set to true, validates an MD5 hash for each retrieved portion of the blob. This is primarily valuable for detecting bitflips on the wire if using http instead of https as https (the default) will already validate. Note that the service will only return transactional MD5s for chunks 4MB or less so the first get request will be of size self.MAX_CHUNK_GET_SIZE instead of self.MAX_SINGLE_GET_SIZE. If self.MAX_CHUNK_GET_SIZE was set to greater than 4MB an error will be thrown. As computing the MD5 takes processing time and more requests will need to be done due to the reduced chunk size there may be some increase in latency. Default value: False
|
progress_callback
|
<xref:func>(<xref:current>, <xref:total>)
Callback for progress with signature function(current, total) where current is the number of bytes transfered so far, and total is the size of the blob if known. Default value: None
|
max_connections
|
If set to 2 or greater, an initial get will be done for the first self.MAX_SINGLE_GET_SIZE bytes of the blob. If this is the entire blob, the method returns at this point. If it is not, it will download the remaining data parallel using the number of threads equal to max_connections. Each chunk will be of size self.MAX_CHUNK_GET_SIZE. If set to 1, a single large get request will be done. This is not generally recommended but available if very few threads should be used, network requests are very expensive, or a non-seekable stream prevents parallel download. This may also be useful if many blobs are expected to be empty as an extra request is required for empty blobs if max_connections is greater than 1. Default value: 2
|
lease_id
|
Required if the blob has an active lease. Default value: None
|
if_modified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has been modified since the specified time. Default value: None
|
if_unmodified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has not been modified since the specified date/time. Default value: None
|
if_match
|
An ETag value, or the wildcard character (*). Specify this header to perform the operation only if the resource's ETag matches the value specified. Default value: None
|
if_none_match
|
An ETag value, or the wildcard character (). Specify this header to perform the operation only if the resource's ETag does not match the value specified. Specify the wildcard character () to perform the operation only if the resource does not exist, and fail the operation if it does exist. Default value: None
|
cpk
|
Decrypts 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. Default value: None
|
timeout
|
The timeout parameter is expressed in seconds. This method may make multiple calls to the Azure service and the timeout will apply to each call individually. Default value: None
|
Returns
Type | Description |
---|---|
A Blob with properties and metadata. If max_connections is greater than 1, the content_md5 (if set on the blob) will not be returned. If you require this value, either use get_blob_properties or set max_connections to 1. |
get_blob_to_path
Downloads a blob to a file path, with automatic chunking and progress notifications. Returns an instance of Blob with properties and metadata.
get_blob_to_path(container_name, blob_name, file_path, open_mode='wb', snapshot=None, start_range=None, end_range=None, validate_content=False, progress_callback=None, max_connections=2, lease_id=None, if_modified_since=None, if_unmodified_since=None, if_match=None, if_none_match=None, timeout=None, cpk=None)
Parameters
Name | Description |
---|---|
container_name
Required
|
Name of existing container. |
blob_name
Required
|
Name of existing blob. |
file_path
Required
|
Path of file to write out to. |
open_mode
|
Mode to use when opening the file. Note that specifying append only open_mode prevents parallel download. So, max_connections must be set to 1 if this open_mode is used. Default value: wb
|
snapshot
|
The snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to retrieve. Default value: None
|
start_range
|
Start of byte range to use for downloading a section of the blob. If no end_range is given, all bytes after the start_range will be downloaded. The start_range and end_range params are inclusive. Ex: start_range=0, end_range=511 will download first 512 bytes of blob. Default value: None
|
end_range
|
End of byte range to use for downloading a section of the blob. If end_range is given, start_range must be provided. The start_range and end_range params are inclusive. Ex: start_range=0, end_range=511 will download first 512 bytes of blob. Default value: None
|
validate_content
|
If set to true, validates an MD5 hash for each retrieved portion of the blob. This is primarily valuable for detecting bitflips on the wire if using http instead of https as https (the default) will already validate. Note that the service will only return transactional MD5s for chunks 4MB or less so the first get request will be of size self.MAX_CHUNK_GET_SIZE instead of self.MAX_SINGLE_GET_SIZE. If self.MAX_CHUNK_GET_SIZE was set to greater than 4MB an error will be thrown. As computing the MD5 takes processing time and more requests will need to be done due to the reduced chunk size there may be some increase in latency. Default value: False
|
progress_callback
|
<xref:func>(<xref:current>, <xref:total>)
Callback for progress with signature function(current, total) where current is the number of bytes transfered so far, and total is the size of the blob if known. Default value: None
|
max_connections
|
If set to 2 or greater, an initial get will be done for the first self.MAX_SINGLE_GET_SIZE bytes of the blob. If this is the entire blob, the method returns at this point. If it is not, it will download the remaining data parallel using the number of threads equal to max_connections. Each chunk will be of size self.MAX_CHUNK_GET_SIZE. If set to 1, a single large get request will be done. This is not generally recommended but available if very few threads should be used, network requests are very expensive, or a non-seekable stream prevents parallel download. This may also be useful if many blobs are expected to be empty as an extra request is required for empty blobs if max_connections is greater than 1. Default value: 2
|
lease_id
|
Required if the blob has an active lease. Default value: None
|
if_modified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has been modified since the specified time. Default value: None
|
if_unmodified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has not been modified since the specified date/time. Default value: None
|
if_match
|
An ETag value, or the wildcard character (*). Specify this header to perform the operation only if the resource's ETag matches the value specified. Default value: None
|
if_none_match
|
An ETag value, or the wildcard character (). Specify this header to perform the operation only if the resource's ETag does not match the value specified. Specify the wildcard character () to perform the operation only if the resource does not exist, and fail the operation if it does exist. Default value: None
|
cpk
|
Decrypts 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. Default value: None
|
timeout
|
The timeout parameter is expressed in seconds. This method may make multiple calls to the Azure service and the timeout will apply to each call individually. Default value: None
|
Returns
Type | Description |
---|---|
A Blob with properties and metadata. If max_connections is greater than 1, the content_md5 (if set on the blob) will not be returned. If you require this value, either use get_blob_properties or set max_connections to 1. |
get_blob_to_stream
Downloads a blob to a stream, with automatic chunking and progress notifications. Returns an instance of Blob with properties and metadata.
get_blob_to_stream(container_name, blob_name, stream, snapshot=None, start_range=None, end_range=None, validate_content=False, progress_callback=None, max_connections=2, lease_id=None, if_modified_since=None, if_unmodified_since=None, if_match=None, if_none_match=None, timeout=None, cpk=None)
Parameters
Name | Description |
---|---|
container_name
Required
|
Name of existing container. |
blob_name
Required
|
Name of existing blob. |
stream
Required
|
Opened stream to write to. |
snapshot
|
The snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to retrieve. Default value: None
|
start_range
|
Start of byte range to use for downloading a section of the blob. If no end_range is given, all bytes after the start_range will be downloaded. The start_range and end_range params are inclusive. Ex: start_range=0, end_range=511 will download first 512 bytes of blob. Default value: None
|
end_range
|
End of byte range to use for downloading a section of the blob. If end_range is given, start_range must be provided. The start_range and end_range params are inclusive. Ex: start_range=0, end_range=511 will download first 512 bytes of blob. Default value: None
|
validate_content
|
If set to true, validates an MD5 hash for each retrieved portion of the blob. This is primarily valuable for detecting bitflips on the wire if using http instead of https as https (the default) will already validate. Note that the service will only return transactional MD5s for chunks 4MB or less so the first get request will be of size self.MAX_CHUNK_GET_SIZE instead of self.MAX_SINGLE_GET_SIZE. If self.MAX_CHUNK_GET_SIZE was set to greater than 4MB an error will be thrown. As computing the MD5 takes processing time and more requests will need to be done due to the reduced chunk size there may be some increase in latency. Default value: False
|
progress_callback
|
<xref:func>(<xref:current>, <xref:total>)
Callback for progress with signature function(current, total) where current is the number of bytes transfered so far, and total is the size of the blob if known. Default value: None
|
max_connections
|
If set to 2 or greater, an initial get will be done for the first self.MAX_SINGLE_GET_SIZE bytes of the blob. If this is the entire blob, the method returns at this point. If it is not, it will download the remaining data parallel using the number of threads equal to max_connections. Each chunk will be of size self.MAX_CHUNK_GET_SIZE. If set to 1, a single large get request will be done. This is not generally recommended but available if very few threads should be used, network requests are very expensive, or a non-seekable stream prevents parallel download. This may also be useful if many blobs are expected to be empty as an extra request is required for empty blobs if max_connections is greater than 1. Default value: 2
|
lease_id
|
Required if the blob has an active lease. Default value: None
|
if_modified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has been modified since the specified time. Default value: None
|
if_unmodified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has not been modified since the specified date/time. Default value: None
|
if_match
|
An ETag value, or the wildcard character (*). Specify this header to perform the operation only if the resource's ETag matches the value specified. Default value: None
|
if_none_match
|
An ETag value, or the wildcard character (). Specify this header to perform the operation only if the resource's ETag does not match the value specified. Specify the wildcard character () to perform the operation only if the resource does not exist, and fail the operation if it does exist. Default value: None
|
cpk
|
Decrypts 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. Default value: None
|
timeout
|
The timeout parameter is expressed in seconds. This method may make multiple calls to the Azure service and the timeout will apply to each call individually. Default value: None
|
Returns
Type | Description |
---|---|
A Blob with properties and metadata. If max_connections is greater than 1, the content_md5 (if set on the blob) will not be returned. If you require this value, either use get_blob_properties or set max_connections to 1. |
get_blob_to_text
Downloads a blob as unicode text, with automatic chunking and progress notifications. Returns an instance of Blob with properties, metadata, and content.
get_blob_to_text(container_name, blob_name, encoding='utf-8', snapshot=None, start_range=None, end_range=None, validate_content=False, progress_callback=None, max_connections=2, lease_id=None, if_modified_since=None, if_unmodified_since=None, if_match=None, if_none_match=None, timeout=None, cpk=None)
Parameters
Name | Description |
---|---|
container_name
Required
|
Name of existing container. |
blob_name
Required
|
Name of existing blob. |
encoding
|
Python encoding to use when decoding the blob data. Default value: utf-8
|
snapshot
|
The snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to retrieve. Default value: None
|
start_range
|
Start of byte range to use for downloading a section of the blob. If no end_range is given, all bytes after the start_range will be downloaded. The start_range and end_range params are inclusive. Ex: start_range=0, end_range=511 will download first 512 bytes of blob. Default value: None
|
end_range
|
End of byte range to use for downloading a section of the blob. If end_range is given, start_range must be provided. The start_range and end_range params are inclusive. Ex: start_range=0, end_range=511 will download first 512 bytes of blob. Default value: None
|
validate_content
|
If set to true, validates an MD5 hash for each retrieved portion of the blob. This is primarily valuable for detecting bitflips on the wire if using http instead of https as https (the default) will already validate. Note that the service will only return transactional MD5s for chunks 4MB or less so the first get request will be of size self.MAX_CHUNK_GET_SIZE instead of self.MAX_SINGLE_GET_SIZE. If self.MAX_CHUNK_GET_SIZE was set to greater than 4MB an error will be thrown. As computing the MD5 takes processing time and more requests will need to be done due to the reduced chunk size there may be some increase in latency. Default value: False
|
progress_callback
|
<xref:func>(<xref:current>, <xref:total>)
Callback for progress with signature function(current, total) where current is the number of bytes transfered so far, and total is the size of the blob if known. Default value: None
|
max_connections
|
If set to 2 or greater, an initial get will be done for the first self.MAX_SINGLE_GET_SIZE bytes of the blob. If this is the entire blob, the method returns at this point. If it is not, it will download the remaining data parallel using the number of threads equal to max_connections. Each chunk will be of size self.MAX_CHUNK_GET_SIZE. If set to 1, a single large get request will be done. This is not generally recommended but available if very few threads should be used, network requests are very expensive, or a non-seekable stream prevents parallel download. This may also be useful if many blobs are expected to be empty as an extra request is required for empty blobs if max_connections is greater than 1. Default value: 2
|
lease_id
|
Required if the blob has an active lease. Default value: None
|
if_modified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has been modified since the specified time. Default value: None
|
if_unmodified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has not been modified since the specified date/time. Default value: None
|
if_match
|
An ETag value, or the wildcard character (*). Specify this header to perform the operation only if the resource's ETag matches the value specified. Default value: None
|
if_none_match
|
An ETag value, or the wildcard character (). Specify this header to perform the operation only if the resource's ETag does not match the value specified. Specify the wildcard character () to perform the operation only if the resource does not exist, and fail the operation if it does exist. Default value: None
|
cpk
|
Decrypts 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. Default value: None
|
timeout
|
The timeout parameter is expressed in seconds. This method may make multiple calls to the Azure service and the timeout will apply to each call individually. Default value: None
|
Returns
Type | Description |
---|---|
A Blob with properties and metadata. If max_connections is greater than 1, the content_md5 (if set on the blob) will not be returned. If you require this value, either use get_blob_properties or set max_connections to 1. |
get_container_acl
Gets the permissions for the specified container. The permissions indicate whether container data may be accessed publicly.
get_container_acl(container_name, lease_id=None, timeout=None)
Parameters
Name | Description |
---|---|
container_name
Required
|
Name of existing container. |
lease_id
|
If specified, get_container_acl only succeeds if the container's lease is active and matches this ID. Default value: None
|
timeout
|
The timeout parameter is expressed in seconds. Default value: None
|
Returns
Type | Description |
---|---|
A dictionary of access policies associated with the container. dict of str to AccessPolicy and a public_access property if public access is turned on |
get_container_metadata
Returns all user-defined metadata for the specified container.
get_container_metadata(container_name, lease_id=None, timeout=None)
Parameters
Name | Description |
---|---|
container_name
Required
|
Name of existing container. |
lease_id
|
If specified, get_container_metadata only succeeds if the container's lease is active and matches this ID. Default value: None
|
timeout
|
The timeout parameter is expressed in seconds. Default value: None
|
Returns
Type | Description |
---|---|
A dictionary representing the container metadata name, value pairs. |
get_container_properties
Returns all user-defined metadata and system properties for the specified container. The data returned does not include the container's list of blobs.
get_container_properties(container_name, lease_id=None, timeout=None)
Parameters
Name | Description |
---|---|
container_name
Required
|
Name of existing container. |
lease_id
|
If specified, get_container_properties only succeeds if the container's lease is active and matches this ID. Default value: None
|
timeout
|
The timeout parameter is expressed in seconds. Default value: None
|
Returns
Type | Description |
---|---|
properties for the specified container within a container object. |
get_page_ranges
Returns the list of valid page ranges for a Page Blob or snapshot of a page blob.
get_page_ranges(container_name, blob_name, snapshot=None, start_range=None, end_range=None, lease_id=None, if_modified_since=None, if_unmodified_since=None, if_match=None, if_none_match=None, timeout=None)
Parameters
Name | Description |
---|---|
container_name
Required
|
Name of existing container. |
blob_name
Required
|
Name of existing blob. |
snapshot
|
The snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to retrieve information from. Default value: None
|
start_range
|
Start of byte range to use for getting valid page ranges. If no end_range is given, all bytes after the start_range will be searched. Pages must be aligned with 512-byte boundaries, the start offset must be a modulus of 512 and the end offset must be a modulus of 512-1. Examples of valid byte ranges are 0-511, 512-, etc. Default value: None
|
end_range
|
End of byte range to use for getting valid page ranges. If end_range is given, start_range must be provided. This range will return valid page ranges for from the offset start up to offset end. Pages must be aligned with 512-byte boundaries, the start offset must be a modulus of 512 and the end offset must be a modulus of 512-1. Examples of valid byte ranges are 0-511, 512-, etc. Default value: None
|
lease_id
|
Required if the blob has an active lease. Default value: None
|
if_modified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has been modified since the specified time. Default value: None
|
if_unmodified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has not been modified since the specified date/time. Default value: None
|
if_match
|
An ETag value, or the wildcard character (*). Specify this header to perform the operation only if the resource's ETag matches the value specified. Default value: None
|
if_none_match
|
An ETag value, or the wildcard character (). Specify this header to perform the operation only if the resource's ETag does not match the value specified. Specify the wildcard character () to perform the operation only if the resource does not exist, and fail the operation if it does exist. Default value: None
|
timeout
|
The timeout parameter is expressed in seconds. Default value: None
|
Returns
Type | Description |
---|---|
A list of valid Page Ranges for the Page Blob. |
get_page_ranges_diff
The response will include only the pages that are different between either a recent snapshot or the current blob and a previous snapshot, including pages that were cleared.
get_page_ranges_diff(container_name, blob_name, previous_snapshot, snapshot=None, start_range=None, end_range=None, lease_id=None, if_modified_since=None, if_unmodified_since=None, if_match=None, if_none_match=None, timeout=None)
Parameters
Name | Description |
---|---|
container_name
Required
|
Name of existing container. |
blob_name
Required
|
Name of existing blob. |
previous_snapshot
Required
|
The snapshot parameter is an opaque DateTime value that specifies a previous blob snapshot to be compared against a more recent snapshot or the current blob. |
snapshot
|
The snapshot parameter is an opaque DateTime value that specifies a more recent blob snapshot to be compared against a previous snapshot (previous_snapshot). Default value: None
|
start_range
|
Start of byte range to use for getting different page ranges. If no end_range is given, all bytes after the start_range will be searched. Pages must be aligned with 512-byte boundaries, the start offset must be a modulus of 512 and the end offset must be a modulus of 512-1. Examples of valid byte ranges are 0-511, 512-, etc. Default value: None
|
end_range
|
End of byte range to use for getting different page ranges. If end_range is given, start_range must be provided. This range will return valid page ranges for from the offset start up to offset end. Pages must be aligned with 512-byte boundaries, the start offset must be a modulus of 512 and the end offset must be a modulus of 512-1. Examples of valid byte ranges are 0-511, 512-, etc. Default value: None
|
lease_id
|
Required if the blob has an active lease. Default value: None
|
if_modified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has been modified since the specified time. Default value: None
|
if_unmodified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has not been modified since the specified date/time. Default value: None
|
if_match
|
An ETag value, or the wildcard character (*). Specify this header to perform the operation only if the resource's ETag matches the value specified. Default value: None
|
if_none_match
|
An ETag value, or the wildcard character (). Specify this header to perform the operation only if the resource's ETag does not match the value specified. Specify the wildcard character () to perform the operation only if the resource does not exist, and fail the operation if it does exist. Default value: None
|
timeout
|
The timeout parameter is expressed in seconds. Default value: None
|
Returns
Type | Description |
---|---|
A list of different Page Ranges for the Page Blob. |
get_user_delegation_key
Obtain a user delegation key for the purpose of signing SAS tokens. A token credential must be present on the service object for this request to succeed.
get_user_delegation_key(key_start_time, key_expiry_time, timeout=None)
Parameters
Name | Description |
---|---|
key_start_time
Required
|
A DateTime value. Indicates when the key becomes valid. |
key_expiry_time
Required
|
A DateTime value. Indicates when the key stops being valid. |
timeout
|
The timeout parameter is expressed in seconds. Default value: None
|
Returns
Type | Description |
---|---|
The user delegation key. |
incremental_copy_blob
Copies an incremental copy of a blob asynchronously. This operation returns a copy operation properties object, including a copy ID you can use to check or abort the copy operation. The Blob service copies blobs on a best-effort basis.
The source blob for an incremental copy operation must be a page blob. Call get_blob_properties on the destination blob to check the status of the copy operation. The final blob will be committed when the copy completes.
incremental_copy_blob(container_name, blob_name, copy_source, metadata=None, destination_if_modified_since=None, destination_if_unmodified_since=None, destination_if_match=None, destination_if_none_match=None, destination_lease_id=None, source_lease_id=None, timeout=None)
Parameters
Name | Description |
---|---|
container_name
Required
|
Name of the destination container. The container must exist. |
blob_name
Required
|
Name of the destination blob. If the destination blob exists, it will be overwritten. Otherwise, it will be created. |
copy_source
Required
|
A URL of up to 2 KB in length that specifies an Azure page blob. The value should be URL-encoded as it would appear in a request URI. The copy source must be a snapshot and include a valid SAS token or be public. Example: https://myaccount.blob.core.windows.net/mycontainer/myblob?snapshot=&sastoken |
metadata
|
Name-value pairs associated with the blob as metadata. If no name-value pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and metadata is not copied from the source blob or file. Default value: None
|
destination_if_modified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this conditional header to copy the blob only if the destination blob has been modified since the specified date/time. If the destination blob has not been modified, the Blob service returns status code 412 (Precondition Failed). Default value: None
|
destination_if_unmodified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this conditional header to copy the blob only if the destination blob has not been modified since the specified ate/time. If the destination blob has been modified, the Blob service returns status code 412 (Precondition Failed). Default value: None
|
destination_if_match
|
<xref:ETag>
An ETag value, or the wildcard character (*). Specify an ETag value for this conditional header to copy the blob only if the specified ETag value matches the ETag value for an existing destination blob. If the ETag for the destination blob does not match the ETag specified for If-Match, the Blob service returns status code 412 (Precondition Failed). Default value: None
|
destination_if_none_match
|
<xref:ETag>
An ETag value, or the wildcard character (). Specify an ETag value for this conditional header to copy the blob only if the specified ETag value does not match the ETag value for the destination blob. Specify the wildcard character () to perform the operation only if the destination blob does not exist. If the specified condition isn't met, the Blob service returns status code 412 (Precondition Failed). Default value: None
|
destination_lease_id
|
The lease ID specified for this header must match the lease ID of the destination blob. If the request does not include the lease ID or it is not valid, the operation fails with status code 412 (Precondition Failed). Default value: None
|
source_lease_id
|
Specify this to perform the Copy Blob operation only if the lease ID given matches the active lease ID of the source blob. Default value: None
|
timeout
|
The timeout parameter is expressed in seconds. Default value: None
|
Returns
Type | Description |
---|---|
Copy operation properties such as status, source, and ID. |
list_blob_names
Returns a generator to list the blob names under the specified container. The generator will lazily follow the continuation tokens returned by the service and stop when all blobs have been returned or num_results is reached.
If num_results is specified and the account has more than that number of blobs, the generator will have a populated next_marker field once it finishes. This marker can be used to create a new generator if more results are desired.
list_blob_names(container_name, prefix=None, num_results=None, include=None, delimiter=None, marker=None, timeout=None)
Parameters
Name | Description |
---|---|
container_name
Required
|
Name of existing container. |
prefix
|
Filters the results to return only blobs whose names begin with the specified prefix. Default value: None
|
num_results
|
Specifies the maximum number of blobs to return, including all <xref:azure.storage.blob.pageblobservice.BlobPrefix> elements. If the request does not specify num_results or specifies a value greater than 5,000, the server will return up to 5,000 items. Setting num_results to a value less than or equal to zero results in error response code 400 (Bad Request). Default value: None
|
include
|
Specifies one or more additional datasets to include in the response. Default value: None
|
delimiter
|
When the request includes this parameter, the operation returns a BlobPrefix element in the result list that acts as a placeholder for all blobs whose names begin with the same substring up to the appearance of the delimiter character. The delimiter may be a single character or a string. Default value: None
|
marker
|
An opaque continuation token. This value can be retrieved from the next_marker field of a previous generator object if num_results was specified and that generator has finished enumerating results. If specified, this generator will begin returning results from the point where the previous generator stopped. Default value: None
|
timeout
|
The timeout parameter is expressed in seconds. Default value: None
|
list_blobs
Returns a generator to list the blobs under the specified container. The generator will lazily follow the continuation tokens returned by the service and stop when all blobs have been returned or num_results is reached.
If num_results is specified and the account has more than that number of blobs, the generator will have a populated next_marker field once it finishes. This marker can be used to create a new generator if more results are desired.
list_blobs(container_name, prefix=None, num_results=None, include=None, delimiter=None, marker=None, timeout=None)
Parameters
Name | Description |
---|---|
container_name
Required
|
Name of existing container. |
prefix
|
Filters the results to return only blobs whose names begin with the specified prefix. Default value: None
|
num_results
|
Specifies the maximum number of blobs to return, including all <xref:azure.storage.blob.pageblobservice.BlobPrefix> elements. If the request does not specify num_results or specifies a value greater than 5,000, the server will return up to 5,000 items. Setting num_results to a value less than or equal to zero results in error response code 400 (Bad Request). Default value: None
|
include
|
Specifies one or more additional datasets to include in the response. Default value: None
|
delimiter
|
When the request includes this parameter, the operation returns a BlobPrefix element in the result list that acts as a placeholder for all blobs whose names begin with the same substring up to the appearance of the delimiter character. The delimiter may be a single character or a string. Default value: None
|
marker
|
An opaque continuation token. This value can be retrieved from the next_marker field of a previous generator object if num_results was specified and that generator has finished enumerating results. If specified, this generator will begin returning results from the point where the previous generator stopped. Default value: None
|
timeout
|
The timeout parameter is expressed in seconds. Default value: None
|
list_containers
Returns a generator to list the containers under the specified account. The generator will lazily follow the continuation tokens returned by the service and stop when all containers have been returned or num_results is reached.
If num_results is specified and the account has more than that number of containers, the generator will have a populated next_marker field once it finishes. This marker can be used to create a new generator if more results are desired.
list_containers(prefix=None, num_results=None, include_metadata=False, marker=None, timeout=None)
Parameters
Name | Description |
---|---|
prefix
|
Filters the results to return only containers whose names begin with the specified prefix. Default value: None
|
num_results
|
Specifies the maximum number of containers to return. A single list request may return up to 1000 contianers and potentially a continuation token which should be followed to get additional resutls. Default value: None
|
include_metadata
|
Specifies that container metadata be returned in the response. Default value: False
|
marker
|
An opaque continuation token. This value can be retrieved from the next_marker field of a previous generator object if num_results was specified and that generator has finished enumerating results. If specified, this generator will begin returning results from the point where the previous generator stopped. Default value: None
|
timeout
|
The timeout parameter is expressed in seconds. Default value: None
|
make_blob_url
Creates the url to access a blob.
make_blob_url(container_name, blob_name, protocol=None, sas_token=None, snapshot=None)
Parameters
Name | Description |
---|---|
container_name
Required
|
Name of container. |
blob_name
Required
|
Name of blob. |
protocol
|
Protocol to use: 'http' or 'https'. If not specified, uses the protocol specified when BaseBlobService was initialized. Default value: None
|
sas_token
|
Shared access signature token created with generate_shared_access_signature. Default value: None
|
snapshot
|
An string value that uniquely identifies the snapshot. The value of this query parameter indicates the snapshot version. Default value: None
|
Returns
Type | Description |
---|---|
blob access URL. |
make_container_url
Creates the url to access a container.
make_container_url(container_name, protocol=None, sas_token=None)
Parameters
Name | Description |
---|---|
container_name
Required
|
Name of container. |
protocol
|
Protocol to use: 'http' or 'https'. If not specified, uses the protocol specified when BaseBlobService was initialized. Default value: None
|
sas_token
|
Shared access signature token created with generate_shared_access_signature. Default value: None
|
Returns
Type | Description |
---|---|
container access URL. |
release_blob_lease
Releases the lease. The lease may be released if the lease ID specified on the request matches that associated with the blob. Releasing the lease allows another client to immediately acquire the lease for the blob as soon as the release is complete.
release_blob_lease(container_name, blob_name, lease_id, if_modified_since=None, if_unmodified_since=None, if_match=None, if_none_match=None, timeout=None)
Parameters
Name | Description |
---|---|
container_name
Required
|
Name of existing container. |
blob_name
Required
|
Name of existing blob. |
lease_id
Required
|
Lease ID for active lease. |
if_modified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has been modified since the specified time. Default value: None
|
if_unmodified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has not been modified since the specified date/time. Default value: None
|
if_match
|
An ETag value, or the wildcard character (*). Specify this header to perform the operation only if the resource's ETag matches the value specified. Default value: None
|
if_none_match
|
An ETag value, or the wildcard character (). Specify this header to perform the operation only if the resource's ETag does not match the value specified. Specify the wildcard character () to perform the operation only if the resource does not exist, and fail the operation if it does exist. Default value: None
|
timeout
|
The timeout parameter is expressed in seconds. Default value: None
|
release_container_lease
Release the lease. The lease may be released if the lease_id specified matches that associated with the container. Releasing the lease allows another client to immediately acquire the lease for the container as soon as the release is complete.
release_container_lease(container_name, lease_id, if_modified_since=None, if_unmodified_since=None, timeout=None)
Parameters
Name | Description |
---|---|
container_name
Required
|
Name of existing container. |
lease_id
Required
|
Lease ID for active lease. |
if_modified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has been modified since the specified time. Default value: None
|
if_unmodified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has not been modified since the specified date/time. Default value: None
|
timeout
|
The timeout parameter is expressed in seconds. Default value: None
|
renew_blob_lease
Renews the lease. The lease can be renewed if the lease ID specified on the request matches that associated with the blob. Note that the lease may be renewed even if it has expired as long as the blob has not been modified or leased again since the expiration of that lease. When you renew a lease, the lease duration clock resets.
renew_blob_lease(container_name, blob_name, lease_id, if_modified_since=None, if_unmodified_since=None, if_match=None, if_none_match=None, timeout=None)
Parameters
Name | Description |
---|---|
container_name
Required
|
Name of existing container. |
blob_name
Required
|
Name of existing blob. |
lease_id
Required
|
Lease ID for active lease. |
if_modified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has been modified since the specified time. Default value: None
|
if_unmodified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has not been modified since the specified date/time. Default value: None
|
if_match
|
An ETag value, or the wildcard character (*). Specify this header to perform the operation only if the resource's ETag matches the value specified. Default value: None
|
if_none_match
|
An ETag value, or the wildcard character (). Specify this header to perform the operation only if the resource's ETag does not match the value specified. Specify the wildcard character () to perform the operation only if the resource does not exist, and fail the operation if it does exist. Default value: None
|
timeout
|
The timeout parameter is expressed in seconds. Default value: None
|
Returns
Type | Description |
---|---|
str |
renew_container_lease
Renews the lease. The lease can be renewed if the lease ID specified matches that associated with the container. Note that the lease may be renewed even if it has expired as long as the container has not been leased again since the expiration of that lease. When you renew a lease, the lease duration clock resets.
renew_container_lease(container_name, lease_id, if_modified_since=None, if_unmodified_since=None, timeout=None)
Parameters
Name | Description |
---|---|
container_name
Required
|
Name of existing container. |
lease_id
Required
|
Lease ID for active lease. |
if_modified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has been modified since the specified time. Default value: None
|
if_unmodified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has not been modified since the specified date/time. Default value: None
|
timeout
|
The timeout parameter is expressed in seconds. Default value: None
|
Returns
Type | Description |
---|---|
str |
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(container_name, blob_name, content_length, lease_id=None, if_modified_since=None, if_unmodified_since=None, if_match=None, if_none_match=None, timeout=None)
Parameters
Name | Description |
---|---|
container_name
Required
|
Name of existing container. |
blob_name
Required
|
Name of existing blob. |
content_length
Required
|
Size to resize blob to. |
lease_id
|
Required if the blob has an active lease. Default value: None
|
if_modified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has been modified since the specified time. Default value: None
|
if_unmodified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has not been modified since the specified date/time. Default value: None
|
if_match
|
An ETag value, or the wildcard character (*). Specify this header to perform the operation only if the resource's ETag matches the value specified. Default value: None
|
if_none_match
|
An ETag value, or the wildcard character (). Specify this header to perform the operation only if the resource's ETag does not match the value specified. Specify the wildcard character () to perform the operation only if the resource does not exist, and fail the operation if it does exist. Default value: None
|
timeout
|
The timeout parameter is expressed in seconds. Default value: None
|
Returns
Type | Description |
---|---|
ETag and last modified properties for the updated Page Blob |
set_blob_metadata
Sets user-defined metadata for the specified blob as one or more name-value pairs.
set_blob_metadata(container_name, blob_name, metadata=None, lease_id=None, if_modified_since=None, if_unmodified_since=None, if_match=None, if_none_match=None, timeout=None, cpk=None)
Parameters
Name | Description |
---|---|
container_name
Required
|
Name of existing container. |
blob_name
Required
|
Name of existing blob. |
metadata
|
Dict containing name and value pairs. Each call to this operation replaces all existing metadata attached to the blob. To remove all metadata from the blob, call this operation with no metadata headers. Default value: None
|
lease_id
|
Required if the blob has an active lease. Default value: None
|
if_modified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has been modified since the specified time. Default value: None
|
if_unmodified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has not been modified since the specified date/time. Default value: None
|
if_match
|
An ETag value, or the wildcard character (*). Specify this header to perform the operation only if the resource's ETag matches the value specified. Default value: None
|
if_none_match
|
An ETag value, or the wildcard character (). Specify this header to perform the operation only if the resource's ETag does not match the value specified. Specify the wildcard character () to perform the operation only if the resource does not exist, and fail the operation if it does exist. Default value: None
|
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. Default value: None
|
timeout
|
The timeout parameter is expressed in seconds. Default value: None
|
Returns
Type | Description |
---|---|
ETag and last modified properties for the updated Blob |
set_blob_properties
Sets system properties on the blob. If one property is set for the content_settings, all properties will be overriden.
set_blob_properties(container_name, blob_name, content_settings=None, lease_id=None, if_modified_since=None, if_unmodified_since=None, if_match=None, if_none_match=None, timeout=None, cpk=None)
Parameters
Name | Description |
---|---|
container_name
Required
|
Name of existing container. |
blob_name
Required
|
Name of existing blob. |
content_settings
|
ContentSettings object used to set blob properties. Default value: None
|
lease_id
|
Required if the blob has an active lease. Default value: None
|
if_modified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has been modified since the specified time. Default value: None
|
if_unmodified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has not been modified since the specified date/time. Default value: None
|
if_match
|
An ETag value, or the wildcard character (*). Specify this header to perform the operation only if the resource's ETag matches the value specified. Default value: None
|
if_none_match
|
An ETag value, or the wildcard character (). Specify this header to perform the operation only if the resource's ETag does not match the value specified. Specify the wildcard character () to perform the operation only if the resource does not exist, and fail the operation if it does exist. Default value: None
|
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. Default value: None
|
timeout
|
The timeout parameter is expressed in seconds. Default value: None
|
Returns
Type | Description |
---|---|
ETag and last modified properties for the updated Blob |
set_blob_service_properties
Sets the properties of a storage account's Blob service, including Azure Storage Analytics. If an element (ex Logging) is left as None, the existing settings on the service for that functionality are preserved.
set_blob_service_properties(logging=None, hour_metrics=None, minute_metrics=None, cors=None, target_version=None, timeout=None, delete_retention_policy=None, static_website=None)
Parameters
Name | Description |
---|---|
logging
|
Groups the Azure Analytics Logging settings. Default value: None
|
hour_metrics
|
The hour metrics settings provide a summary of request statistics grouped by API in hourly aggregates for blobs. Default value: None
|
minute_metrics
|
The minute metrics settings provide request statistics for each minute for blobs. Default value: None
|
cors
|
list(CorsRule)
You can include up to five CorsRule elements in the list. If an empty list is specified, all CORS rules will be deleted, and CORS will be disabled for the service. Default value: None
|
target_version
|
Indicates the default version to use for requests if an incoming request's version is not specified. Default value: None
|
timeout
|
The timeout parameter is expressed in seconds. Default value: None
|
delete_retention_policy
|
The delete retention policy specifies whether to retain deleted blobs. It also specifies the number of days and versions of blob to keep. Default value: None
|
static_website
|
Specifies whether the static website feature is enabled, and if yes, indicates the index document and 404 error document to use. Default value: None
|
set_container_acl
Sets the permissions for the specified container or stored access policies that may be used with Shared Access Signatures. The permissions indicate whether blobs in a container may be accessed publicly.
set_container_acl(container_name, signed_identifiers=None, public_access=None, lease_id=None, if_modified_since=None, if_unmodified_since=None, timeout=None)
Parameters
Name | Description |
---|---|
container_name
Required
|
Name of existing container. |
signed_identifiers
|
dict(str, AccessPolicy)
A dictionary of access policies to associate with the container. The dictionary may contain up to 5 elements. An empty dictionary will clear the access policies set on the service. Default value: None
|
public_access
|
Possible values include: container, blob. Default value: None
|
lease_id
|
If specified, set_container_acl only succeeds if the container's lease is active and matches this ID. Default value: None
|
if_modified_since
|
A datetime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has been modified since the specified date/time. Default value: None
|
if_unmodified_since
|
A datetime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has not been modified since the specified date/time. Default value: None
|
timeout
|
The timeout parameter is expressed in seconds. Default value: None
|
Returns
Type | Description |
---|---|
ETag and last modified properties for the updated Container |
set_container_metadata
Sets one or more user-defined name-value pairs for the specified container. Each call to this operation replaces all existing metadata attached to the container. To remove all metadata from the container, call this operation with no metadata dict.
set_container_metadata(container_name, metadata=None, lease_id=None, if_modified_since=None, timeout=None)
Parameters
Name | Description |
---|---|
container_name
Required
|
Name of existing container. |
metadata
|
A dict containing name-value pairs to associate with the container as metadata. Example: {'category':'test'} Default value: None
|
lease_id
|
If specified, set_container_metadata only succeeds if the container's lease is active and matches this ID. Default value: None
|
if_modified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has been modified since the specified time. Default value: None
|
timeout
|
The timeout parameter is expressed in seconds. Default value: None
|
Returns
Type | Description |
---|---|
ETag and last modified properties for the updated Container |
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(container_name, blob_name, premium_page_blob_tier, timeout=None)
Parameters
Name | Description |
---|---|
container_name
Required
|
Name of existing container. |
blob_name
Required
|
Name of blob to update. |
premium_page_blob_tier
Required
|
A page blob tier value to set the blob to. The tier correlates to the size of the blob and number of allowed IOPS. This is only applicable to page blobs on premium storage accounts. |
timeout
|
The timeout parameter is expressed in seconds. This method may make multiple calls to the Azure service and the timeout will apply to each call individually. Default value: None
|
set_proxy
Sets the proxy server host and port for the HTTP CONNECT Tunnelling.
set_proxy(host, port, user=None, password=None)
Parameters
Name | Description |
---|---|
host
Required
|
Address of the proxy. Ex: '192.168.0.100' |
port
Required
|
Port of the proxy. Ex: 6000 |
user
|
User for proxy authorization. Default value: None
|
password
|
Password for proxy authorization. Default value: None
|
set_sequence_number
Sets the blob sequence number.
set_sequence_number(container_name, blob_name, sequence_number_action, sequence_number=None, lease_id=None, if_modified_since=None, if_unmodified_since=None, if_match=None, if_none_match=None, timeout=None)
Parameters
Name | Description |
---|---|
container_name
Required
|
Name of existing container. |
blob_name
Required
|
Name of existing blob. |
sequence_number_action
Required
|
This property indicates how the service should modify the blob's sequence number. See SequenceNumberAction for more information. |
sequence_number
|
This property sets the blob's sequence number. The sequence number is a user-controlled property that you can use to track requests and manage concurrency issues. Default value: None
|
lease_id
|
Required if the blob has an active lease. Default value: None
|
if_modified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has been modified since the specified time. Default value: None
|
if_unmodified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has not been modified since the specified date/time. Default value: None
|
if_match
|
An ETag value, or the wildcard character (*). Specify this header to perform the operation only if the resource's ETag matches the value specified. Default value: None
|
if_none_match
|
An ETag value, or the wildcard character (). Specify this header to perform the operation only if the resource's ETag does not match the value specified. Specify the wildcard character () to perform the operation only if the resource does not exist, and fail the operation if it does exist. Default value: None
|
timeout
|
The timeout parameter is expressed in seconds. Default value: None
|
Returns
Type | Description |
---|---|
ETag and last modified properties for the updated Page Blob |
snapshot_blob
Creates a read-only snapshot of a blob.
snapshot_blob(container_name, blob_name, metadata=None, if_modified_since=None, if_unmodified_since=None, if_match=None, if_none_match=None, lease_id=None, timeout=None, cpk=None)
Parameters
Name | Description |
---|---|
container_name
Required
|
Name of existing container. |
blob_name
Required
|
Name of existing blob. |
metadata
|
Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are specified, the operation will copy the base blob metadata to the snapshot. If one or more name-value pairs are specified, the snapshot is created with the specified metadata, and metadata is not copied from the base blob. Default value: None
|
if_modified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has been modified since the specified time. Default value: None
|
if_unmodified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has not been modified since the specified date/time. Default value: None
|
if_match
|
An ETag value, or the wildcard character (*). Specify this header to perform the operation only if the resource's ETag matches the value specified. Default value: None
|
if_none_match
|
An ETag value, or the wildcard character (). Specify this header to perform the operation only if the resource's ETag does not match the value specified. Specify the wildcard character () to perform the operation only if the resource does not exist, and fail the operation if it does exist. Default value: None
|
lease_id
|
Required if the blob has an active lease. Default value: None
|
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. Default value: None
|
timeout
|
The timeout parameter is expressed in seconds. Default value: None
|
Returns
Type | Description |
---|---|
snapshot properties |
undelete_blob
The undelete Blob operation restores the contents and metadata of soft deleted blob or snapshot. Attempting to undelete a blob or snapshot that is not soft deleted will succeed without any changes.
undelete_blob(container_name, blob_name, timeout=None)
Parameters
Name | Description |
---|---|
container_name
Required
|
Name of existing container. |
blob_name
Required
|
Name of existing blob. |
timeout
|
The timeout parameter is expressed in seconds. Default value: None
|
update_page
Updates a range of pages.
update_page(container_name, blob_name, page, start_range, end_range, validate_content=False, lease_id=None, if_sequence_number_lte=None, if_sequence_number_lt=None, if_sequence_number_eq=None, if_modified_since=None, if_unmodified_since=None, if_match=None, if_none_match=None, cpk=None, timeout=None)
Parameters
Name | Description |
---|---|
container_name
Required
|
Name of existing container. |
blob_name
Required
|
Name of existing blob. |
page
Required
|
Content of the page. |
start_range
Required
|
Start of byte range to use for writing to a section of the blob. Pages must be aligned with 512-byte boundaries, the start offset must be a modulus of 512 and the end offset must be a modulus of 512-1. Examples of valid byte ranges are 0-511, 512-1023, etc. |
end_range
Required
|
End of byte range to use for writing to a section of the blob. Pages must be aligned with 512-byte boundaries, the start offset must be a modulus of 512 and the end offset must be a modulus of 512-1. Examples of valid byte ranges are 0-511, 512-1023, etc. |
validate_content
|
If true, calculates an MD5 hash of the page content. The storage service checks the hash of the content that has arrived with the hash that was sent. This is primarily valuable for detecting bitflips on the wire if using http instead of https as https (the default) will already validate. Note that this MD5 hash is not stored with the blob. Default value: False
|
lease_id
|
Required if the blob has an active lease. Default value: None
|
if_sequence_number_lte
|
If the blob's sequence number is less than or equal to the specified value, the request proceeds; otherwise it fails. Default value: None
|
if_sequence_number_lt
|
If the blob's sequence number is less than the specified value, the request proceeds; otherwise it fails. Default value: None
|
if_sequence_number_eq
|
If the blob's sequence number is equal to the specified value, the request proceeds; otherwise it fails. Default value: None
|
if_modified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has been modified since the specified time. Default value: None
|
if_unmodified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has not been modified since the specified date/time. Default value: None
|
if_match
|
An ETag value, or the wildcard character (*). Specify an ETag value for this conditional header to write the page only if the blob's ETag value matches the value specified. If the values do not match, the Blob service fails. Default value: None
|
if_none_match
|
An ETag value, or the wildcard character (*). Specify an ETag value for this conditional header to write the page only if the blob's ETag value does not match the value specified. If the values are identical, the Blob service fails. Default value: None
|
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. Default value: None
|
timeout
|
The timeout parameter is expressed in seconds. Default value: None
|
Returns
Type | Description |
---|---|
ETag and last modified properties for the updated Page Blob |
update_page_from_url
Updates a range of pages to a page blob where the contents are read from a URL.
update_page_from_url(container_name, blob_name, start_range, end_range, copy_source_url, source_range_start, source_content_md5=None, source_if_modified_since=None, source_if_unmodified_since=None, source_if_match=None, source_if_none_match=None, lease_id=None, if_sequence_number_lte=None, if_sequence_number_lt=None, if_sequence_number_eq=None, if_modified_since=None, if_unmodified_since=None, if_match=None, if_none_match=None, cpk=None, timeout=None)
Parameters
Name | Description |
---|---|
container_name
Required
|
Name of existing container. |
blob_name
Required
|
Name of blob. |
start_range
Required
|
Start of byte range to use for writing to a section of the blob. Pages must be aligned with 512-byte boundaries, the start offset must be a modulus of 512 and the end offset must be a modulus of 512-1. Examples of valid byte ranges are 0-511, 512-1023, etc. |
end_range
Required
|
End of byte range to use for writing to a section of the blob. Pages must be aligned with 512-byte boundaries, the start offset must be a modulus of 512 and the end offset must be a modulus of 512-1. Examples of valid byte ranges are 0-511, 512-1023, etc. |
copy_source_url
Required
|
The URL of the source data. It can point to any Azure Blob or File, that is either public or has a shared access signature attached. |
source_range_start
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 (end_range-start_range). |
source_content_md5
|
If given, the service will calculate the MD5 hash of the block content and compare against this value. Default value: None
|
source_if_modified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the source resource has been modified since the specified time. Default value: None
|
source_if_unmodified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the source resource has not been modified since the specified date/time. Default value: None
|
source_if_match
|
An ETag value, or the wildcard character (*). Specify this header to perform the operation only if the source resource's ETag matches the value specified. Default value: None
|
source_if_none_match
|
An ETag value, or the wildcard character (). Specify this header to perform the operation only if the source resource's ETag does not match the value specified. Specify the wildcard character () to perform the operation only if the source resource does not exist, and fail the operation if it does exist. Default value: None
|
lease_id
|
Required if the blob has an active lease. Default value: None
|
if_sequence_number_lte
|
If the blob's sequence number is less than or equal to the specified value, the request proceeds; otherwise it fails. Default value: None
|
if_sequence_number_lt
|
If the blob's sequence number is less than the specified value, the request proceeds; otherwise it fails. Default value: None
|
if_sequence_number_eq
|
If the blob's sequence number is equal to the specified value, the request proceeds; otherwise it fails. Default value: None
|
if_modified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has been modified since the specified time. Default value: None
|
if_unmodified_since
|
A DateTime value. Azure expects the date value passed in to be UTC. If timezone is included, any non-UTC datetimes will be converted to UTC. If a date is passed in without timezone info, it is assumed to be UTC. Specify this header to perform the operation only if the resource has not been modified since the specified date/time. Default value: None
|
if_match
|
An ETag value, or the wildcard character (*). Specify this header to perform the operation only if the resource's ETag matches the value specified. Default value: None
|
if_none_match
|
An ETag value, or the wildcard character (). Specify this header to perform the operation only if the resource's ETag does not match the value specified. Specify the wildcard character () to perform the operation only if the resource does not exist, and fail the operation if it does exist. Default value: None
|
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. Default value: None
|
timeout
|
The timeout parameter is expressed in seconds. Default value: None
|
Attributes
protocol
request_session
socket_timeout
MAX_CHUNK_GET_SIZE
MAX_CHUNK_GET_SIZE = 4194304
MAX_PAGE_SIZE
MAX_PAGE_SIZE = 4194304
MAX_SINGLE_GET_SIZE
MAX_SINGLE_GET_SIZE = 33554432
Azure SDK for Python