Fixes
- Fixed issue where batch requests could not be combined with SAS (#9534)
- Batch requests now support applying parameters to individual blobs within the request via passing in a dictionary.
- Metadata cannot have leading space (#11457)
- Improve the performance of upload when using max_concurrency
Notes
- Updated dependency from azure-core<2.0.0,>=1.2.2 to azure-core<2.0.0,>=1.6.0
Fixes
- Fixed issue where batch requests could not be combined with token credentials (#9534)
- Skip '/' in url encoding.
New features
stage_block
now propagates the response from the service.
Fixes
- Fixed a bug where a new transport is being passed in the
get_blob_client
method instead of using the existing one in theContainerClient
.
Notes
- The
StorageUserAgentPolicy
is now replaced with theUserAgentPolicy
from azure-core. With this, the custom user agents are now added as a prefix instead of being appended.
New features
- Added support for the 2019-07-07 service version, and added
api_version
parameter to clients. - Added support for encryption scopes that that could be used to encrypt blob content.
- Added
get_page_range_diff_for_managed_disk
API which returns the list of valid page ranges diff between a snapshot and managed disk or another snapshot.
Fixes
- Responses are always decoded as UTF8
New features
- Added
download_blob
method to thecontainer_client
. - All the clients now have a
close()
method to close the sockets opened by the client when using without a context manager.
Fixes and improvements
- Fixes a bug where determining length breaks while uploading a blob when provided with an invalid fileno.
- Fix metadata not being included in
commit_block_list
operation.
Breaking changes
set_container_access_policy
has required parametersigned_identifiers
.NoRetry
policy has been removed. Use keyword argumentretry_total=0
for no retries.StorageStreamDownloader
is no longer iterable. To iterate over the blob data stream, useStorageStreamDownloader.chunks
.- The public attributes of
StorageStreamDownloader
have been limited to:name
(str): The name of the blob.container
(str): The container the blob is being downloaded from.properties
(BlobProperties
): The properties of the blob.size
(int): The size of the download. Either the total blob size, or the length of a subsection if sepcified. Previously calleddownload_size
.
StorageStreamDownloader
now has new functions:readall()
: Reads the complete download stream, returning bytes. This replaces the functionscontent_as_bytes
andcontent_as_text
which have been deprecated.readinto(stream)
: Download the complete stream into the supplied writable stream, returning the number of bytes written. This replaces the functiondownload_to_stream
which has been deprecated.
- Module level functions
upload_blob_to_url
anddownload_blob_from_url
functions options are now keyword only:overwrite
max_concurrency
encoding
- Removed types that were accidentally exposed from two modules. Only
BlobServiceClient
,ContainerClient
,BlobClient
andBlobLeaseClient
should be imported from azure.storage.blob.aio Logging
has been renamed toBlobAnalyticsLogging
.- Client and model files have been made internal. Users should import from the top level modules
azure.storage.blob
andazure.storage.blob.aio
only. - All operations that take Etag conditional parameters (
if_match
andif_none_match
) now take explicitetag
andmatch_condition
parameters, whereetag
is the Etag value, andmatch_condition
is an instance ofazure.core.MatchConditions
. - The
generate_shared_access_signature
methods on each ofBlobServiceClient
,ContainerClient
andBlobClient
have been replaced by module level functionsgenerate_account_sas
,generate_container_sas
andgenerate_blob_sas
. - The batch APIs now have an additional keyword only argument
raise_on_any_failure
which defaults to True. This will raise an error even if there's a partial batch failure. LeaseClient
has been renamed toBlobLeaseClient
.get_service_stats
now returns a dictget_service_properties
now returns a dict with keys consistent toset_service_properties
New features
- Added async module-level
upload_blob_to_url
anddownload_blob_from_url
functions. ResourceTypes
, andServices
now have methodfrom_string
which takes parameters as a string.
Breaking changes
- Permission models.
AccountPermissions
,BlobPermissions
andContainerPermissions
have been renamed toAccountSasPermissions
,BlobSasPermissions
andContainerSasPermissions
respectively.- enum-like list parameters have been removed from all three of them.
__add__
and__or__
methods are removed.
max_connections
is now renamed tomax_concurrency
.ContainerClient
now accepts onlyaccount_url
with a mandatory string paramcontainer_name
. To use a container_url, the methodfrom_container_url
must be used.BlobClient
now accepts onlyaccount_url
with mandatory string paramscontainer_name
andblob_name
. To use a blob_url, the methodfrom_blob_url
must be used.- Some parameters have become keyword only, rather than positional. Some examples include:
loop
max_concurrency
validate_content
timeout
etc.
- APIs now take in
offset
andlength
instead ofrange_start
andrange_end
consistently.length
is the number of bytes to take in starting from theoffset
. The APIs that have been changed include:get_page_ranges
upload_page
upload_pages_from_url
clear_page
append_block_from_url
block_id
is not optional inBlobBlock
model.
New features
- Add support for delete_blobs API to ContainerClient (Python 3 only)
- Add support for set_standard_blob_tier_blobs to ContainerClient (Python 3 only)
- Add support for set_premium_page_blob_tier_blobs to ContainerClient (Python 3 only)
- Added support to set rehydrate blob priority for Block Blob, including Set Standard Blob Tier/Copy Blob APIs
- Added blob tier support for Block Blob, including Upload Blob/Commit Block List/Copy Blob APIs.
AccountSasPermissions
,BlobSasPermissions
,ContainerSasPermissions
now have methodfrom_string
which takes parameters as a string.
Fixes and improvements
- Downloading page blobs now take advantage of their sparseness.
- The
length
param indownload_blob
now takes the number of bytes to take in starting from theoffset
instead of a harde set end value.
Dependency updates
-
Adopted azure-core 1.0.0b4
- If you later want to revert to previous versions of azure-storage-blob, or another Azure SDK library requiring azure-core 1.0.0b1 or azure-core 1.0.0b2, you must explicitly install the specific version of azure-core as well. For example:
pip install azure-core==1.0.0b2 azure-storage-blob==12.0.0b2
New features
- Added SAS support for snapshot and identity.
- Distributed tracing framework OpenCensus is now supported.
- Added support for append_block_from_url API for append blobs.
- Added support for upload_pages_from_url API for page blobs.
- Added support for client provided encryption key to numerous APIs.
Dependency updates
-
Adopted azure-core 1.0.0b3
- If you later want to revert to previous versions of azure-storage-blob, or another Azure SDK library requiring azure-core 1.0.0b1 or azure-core 1.0.0b2, you must explicitly install the specific version of azure-core as well. For example:
pip install azure-core==1.0.0b2 azure-storage-blob==12.0.0b2
Fixes and improvements
- Fix where content-type was being added in the request when not mentioned explicitly.
Breaking changes
- Renamed
copy_blob_from_url
tostart_copy_from_url
and changed behaviour to return a dictionary of copy properties rather than a polling object. Status of the copy operation can be retrieved with theget_blob_properties
operation. - Added
abort_copy
operation to theBlobClient
class. This replaces the previous abort operation on the copy status polling operation. - The behavior of listing operations has been modified:
- The previous
marker
parameter has been removed. - The iterable response object now supports a
by_page
function that will return a secondary iterator of batches of results. This function supports acontinuation_token
parameter to replace the previousmarker
parameter.
- The previous
- Some parameters have become keyword only, rather than positional. Some examples include:
timeout
lease
encoding
- Modification conditions, e.g.
if_modified_since
,if_match
,maxsize_condition
, etc
New features
- Added async APIs to subnamespace
azure.storage.blob.aio
. - Distributed tracing framework OpenCensus is now supported.
Dependency updates
-
Adopted azure-core 1.0.0b2
- If you later want to revert to azure-storage-blob 12.0.0b1, or another Azure SDK library requiring azure-core 1.0.0b1, you must explicitly install azure-core 1.0.0b1 as well. For example:
pip install azure-core==1.0.0b1 azure-storage-blob==12.0.0b1
Fixes and improvements
- Fix for SAS URL encoding (#6500)
- General refactor of duplicate and shared code.
Version 12.0.0b1 is the first preview of our efforts to create a user-friendly and Pythonic client library for Azure Storage Blobs. For more information about this, and preview releases of other Azure SDK libraries, please visit https://aka.ms/azure-sdk-preview1-python.
Breaking changes: New API design
-
Operations are now scoped to a particular client:
BlobServiceClient
: This client handles account-level operations. This includes managing service properties and listing the containers within an account.ContainerClient
: The client handles operations for a particular container. This includes creating or deleting that container, as well as listing the blobs within that container and managing properties and metadata.BlobClient
: The client handles operations for a particular blob. This includes creating or deleting that blob, as well as upload and download data and managing properties. This BlobClient handles all blob types (block, page and append). Where operations can behave differently according to type (i.e.upload_blob
) the default behaviour will be block blobs unless otherwise specified.LeaseClient
: Handles all lease operations for both containers and blobs.
These clients can be accessed by navigating down the client hierarchy, or instantiated directly using URLs to the resource (account, container or blob). For full details on the new API, please see the reference documentation.
-
Copy blob operations now return a polling object that can be used to check the status of the operation, as well as abort the operation.
-
New module level operations for simple upload and download using a blob URL.
-
Download operations now return a streaming object that can download data in multiple ways:
- Iteration: The streamer is an iterable object that will download and yield the content in chunks. Only supports single threaded download.
content_as_bytes
: Return the entire blob content as bytes. Blocking operation that supports multi-threaded download.content_as_text
: Return the entire blob content as decoded text. Blocking operation that supports multi-threaded download.download_to_stream
: Download the entire content to an open stream handle (e.g. an open file). Supports multi-threaded download.
-
New underlying REST pipeline implementation, based on the new
azure-core
library. -
Client and pipeline configuration is now available via keyword arguments at both the client level, and per-operation. See reference documentation for a full list of optional configuration arguments.
-
Authentication using
azure-identity
credentials- see the Azure Identity documentation for more information
-
New error hierarchy:
- All service errors will now use the base type:
azure.core.exceptions.HttpResponseError
- The are a couple of specific exception types derived from this base type for common error scenarios:
ResourceNotFoundError
: The resource (e.g. queue, message) could not be found. Commonly a 404 status code.ResourceExistsError
: A resource conflict - commonly caused when attempting to create a resource that already exists.ResourceModifiedError
: The resource has been modified (e.g. overwritten) and therefore the current operation is in conflict. Alternatively this may be raised if a condition on the operation is not met.ClientAuthenticationError
: Authentication failed.
- All service errors will now use the base type:
-
Operation
set_blob_properties
has been renamed toset_http_headers
. -
Operations
get_blob_to_<output>
have been replaced withdownload_blob
. See above for download output options. -
Operations
create_blob_from_<input>
have been replace withupload_blob
. -
Operation
create_blob
has been renamed to separatecreate_page_blob
andcreate_append_blob
. -
Operations
get_container_acl
andset_container_acl
have been renamed toget_container_access_policy
andset_container_access_policy
. -
Operation
snapshot_blob
has been renamed tocreate_snapshot
. -
Operation
copy_blob
has been renamed tocopy_blob_from_url
. -
Operations
put_block
andput_block_from_url
have been renamed tostage_block
andstage_block_from_url
. -
Operation
put_block_list
has been renamed tocommit_block_list
. -
No longer have specific operations for
get_metadata
- useget_properties
instead. -
No longer have specific operations for
exists
- useget_properties
instead. -
Operation
incremental_copy_blob
has been replaced by an optional boolean flag in thecopy_blob_from_url
operation. -
Operation
update_page
has been renamed toupload_page
. -
Operation
get_page_ranges_diff
has been replaced by an optional str flag in theget_page_ranges
operation.
- Updated dependency on azure-storage-common.
- Support for 2018-11-09 REST version. Please see our REST API documentation and blog for information about the related added features.
- Added support for append block from URL(synchronously) for append blobs.
- Added support for update page from URL(synchronously) for page blobs.
- Added support for generating and using blob snapshot SAS tokens.
- Added support for generating user delegation SAS tokens.
- Added new method list_blob_names to efficiently list only blob names in an efficient way.
- azure-storage-nspkg is not installed anymore on Python 3 (PEP420-based namespace package)
- copy_blob method added to BlockBlobService to enable support for deep sync copy.
- Fixed design flaw where get_blob_to_* methods buffer entire blob when max_connections is set to 1.
- Added support for access conditions on append_blob_from_* methods.
- Support for 2018-03-28 REST version. Please see our REST API documentation and blog for information about the related added features.
- Added support for setting static website service properties.
- Added support for getting account information, such as SKU name and account kind.
- Added support for put block from URL(synchronously).
- Support for 2017-11-09 REST version. Please see our REST API documentation and blog for information about the related added features.
- Support for write-once read-many containers.
- Added support for OAuth authentication for HTTPS requests(Please note that this feature is available in preview).
- Support for 2017-07-29 REST version. Please see our REST API documentation and blogs for information about the related added features.
- Added support for soft delete feature. If a delete retention policy is enabled through the set service properties API, then blobs or snapshots could be deleted softly and retained for a specified number of days, before being permanently removed by garbage collection.
- Error message now contains the ErrorCode from the x-ms-error-code header value.
- The package has switched from Apache 2.0 to the MIT license.
- Fixed bug where get_blob_to_* cannot get a single byte when start_range and end_range are both equal to 0.
- Optimized page blob upload for create_blob_from_* methods, by skipping the empty chunks.
- Added convenient method to generate container url (make_container_url).
- Metadata keys are now case-preserving when fetched from the service. Previously they were made lower-case by the library.
- Enabling MD5 validation no longer uses the memory-efficient algorithm for large block blobs, since computing the MD5 hash requires reading the entire block into memory.
- Fixed a bug in the _SubStream class which was at risk of causing data corruption when using the memory-efficient algorithm for large block blobs.
- Support for AccessTierChangeTime to get the last time a tier was modified on an individual blob.