A client to interact with a specific blob, although that blob may not yet exist.
For more optional configuration, please click here.
ConstructorBlobClient(account_url: str, container_name: str, blob_name: str, snapshot: str | Dict[str, Any] | None = None, credential: str | Dict[str, str] | AzureNamedKeyCredential | AzureSasCredential | TokenCredential | None = None, **kwargs: Any)
Parameters Keyword-Only Parameters Methods abort_copy
Abort an ongoing copy operation.
This will leave a destination blob with zero length and full metadata. This will raise an error if the copy operation has already ended.
acquire_leaseRequests a new lease.
If the blob does not have an active lease, the Blob Service creates a lease on the blob and returns a new lease.
append_blockCommits a new block of data to the end of the existing append blob.
append_block_from_urlCreates a new block to be committed as part of a blob, where the contents are read from a source url.
clear_pageClears a range of pages.
closeThis method is to close the sockets opened by the client. It need not be used when using with a context manager.
commit_block_listThe Commit Block List operation writes a blob by specifying the list of block IDs that make up the blob.
create_append_blobCreates a new Append Blob. This operation creates a new 0-length append blob. The content of any existing blob is overwritten with the newly initialized append blob. To add content to the append blob, call the append_block or append_block_from_url method.
create_page_blobCreates a new Page Blob of the specified size.
create_snapshotCreates a snapshot of the blob.
A snapshot is a read-only version of a blob that's taken at a point in time. It can be read, copied, or deleted, but not modified. Snapshots provide a way to back up a blob as it appears at a moment in time.
A snapshot of a blob has the same name as the base blob from which the snapshot is taken, with a DateTime value appended to indicate the time at which the snapshot was taken.
delete_blobMarks the specified blob for deletion.
The blob is later deleted during garbage collection. Note that in order to delete a blob, you must delete all of its snapshots. You can delete both at the same time with the delete_blob() operation.
If a delete retention policy is enabled for the service, then this operation soft deletes the blob and retains the blob for a specified number of days. After the specified number of days, the blob's data is removed from the service during garbage collection. Soft deleted blob is accessible through list_blobs specifying include=['deleted'] option. Soft-deleted blob can be restored using <xref:azure.storage.blob.undelete> operation.
delete_immutability_policyThe Delete Immutability Policy operation deletes the immutability policy on the blob.
New in version 12.10.0: This operation was introduced in API version '2020-10-02'.
download_blobDownloads a blob to the StorageStreamDownloader. The readall() method must be used to read all the content or readinto() must be used to download the blob into a stream. Using chunks() returns an iterator which allows the user to iterate over the content in chunks.
existsReturns True if a blob exists with the defined parameters, and returns False otherwise.
from_blob_urlCreate BlobClient from a blob url. This doesn't support customized blob url with '/' in blob name.
from_connection_stringCreate BlobClient from a Connection String.
get_account_informationGets information related to the storage account in which the blob resides.
The information can also be retrieved if the user has a SAS to a container or blob. The keys in the returned dictionary include 'sku_name' and 'account_kind'.
get_blob_propertiesReturns all user-defined metadata, standard HTTP properties, and system properties for the blob. It does not return the content of the blob.
get_blob_tagsThe Get Tags operation enables users to get tags on a blob or specific blob version, or snapshot.
New in version 12.4.0: This operation was introduced in API version '2019-12-12'.
get_block_listThe Get Block List operation retrieves the list of blocks that have been uploaded as part of a block blob.
get_page_range_diff_for_managed_diskReturns the list of valid page ranges for a managed disk or snapshot.
Note
This operation is only available for managed disk accounts.
New in version 12.2.0: This operation was introduced in API version '2019-07-07'.
get_page_rangesDEPRECATED: Returns the list of valid page ranges for a Page Blob or snapshot of a page blob.
list_page_rangesReturns the list of valid page ranges for a Page Blob or snapshot of a page blob. If previous_snapshot is specified, the result will be a diff of changes between the target blob and the previous snapshot.
query_blobEnables users to select/project on blob/or blob snapshot data by providing simple query expressions. This operations returns a BlobQueryReader, users need to use readall() or readinto() to get query data.
resize_blobResizes a page blob to the specified size.
If the specified value is less than the current size of the blob, then all pages above the specified value are cleared.
seal_append_blobThe Seal operation seals the Append Blob to make it read-only.
New in version 12.4.0.
set_blob_metadataSets user-defined metadata for the blob as one or more name-value pairs.
set_blob_tagsThe Set Tags operation enables users to set tags on a blob or specific blob version, but not snapshot. Each call to this operation replaces all existing tags attached to the blob. To remove all tags from the blob, call this operation with no tags set.
New in version 12.4.0: This operation was introduced in API version '2019-12-12'.
set_http_headersSets system properties on the blob.
If one property is set for the content_settings, all properties will be overridden.
set_immutability_policyThe Set Immutability Policy operation sets the immutability policy on the blob.
New in version 12.10.0: This operation was introduced in API version '2020-10-02'.
set_legal_holdThe Set Legal Hold operation sets a legal hold on the blob.
New in version 12.10.0: This operation was introduced in API version '2020-10-02'.
set_premium_page_blob_tierSets the page blob tiers on the blob. This API is only supported for page blobs on premium accounts.
set_sequence_numberSets the blob sequence number.
set_standard_blob_tierThis operation sets the tier on a block blob.
A block blob's tier determines Hot/Cool/Archive storage type. This operation does not update the blob's ETag.
stage_blockCreates a new block to be committed as part of a blob.
stage_block_from_urlCreates a new block to be committed as part of a blob where the contents are read from a URL.
start_copy_from_urlCopies a blob from the given URL.
This operation returns a dictionary containing copy_status and copy_id, which can be used to check the status of or abort the copy operation. copy_status will be 'success' if the copy completed synchronously or 'pending' if the copy has been started asynchronously. For asynchronous copies, the status can be checked by polling the get_blob_properties method and checking the copy status. Set requires_sync to True to force the copy to be synchronous. The Blob service copies blobs on a best-effort basis.
The source blob for a copy operation may be a block blob, an append blob, or a page blob. If the destination blob already exists, it must be of the same blob type as the source blob. Any existing destination blob will be overwritten. The destination blob cannot be modified while a copy operation is in progress.
When copying from a page blob, the Blob service creates a destination page blob of the source blob's length, initially containing all zeroes. Then the source page ranges are enumerated, and non-empty ranges are copied.
For a block blob or an append blob, the Blob service creates a committed blob of zero length before returning from this operation. When copying from a block blob, all committed blocks and their block IDs are copied. Uncommitted blocks are not copied. At the end of the copy operation, the destination blob will have the same committed block count as the source.
When copying from an append blob, all committed blocks are copied. At the end of the copy operation, the destination blob will have the same committed block count as the source.
undelete_blobRestores soft-deleted blobs or snapshots.
Operation will only be successful if used within the specified number of days set in the delete retention policy.
If blob versioning is enabled, the base blob cannot be restored using this method. Instead use start_copy_from_url with the URL of the blob version you wish to promote to the current version.
upload_blobCreates a new blob from a data source with automatic chunking.
upload_blob_from_urlCreates a new Block Blob where the content of the blob is read from a given URL. The content of an existing blob is overwritten with the new blob.
upload_pageThe Upload Pages operation writes a range of pages to a page blob.
upload_pages_from_urlThe Upload Pages operation writes a range of pages to a page blob where the contents are read from a URL.
abort_copyAbort an ongoing copy operation.
This will leave a destination blob with zero length and full metadata. This will raise an error if the copy operation has already ended.
abort_copy(copy_id: str | Dict[str, Any] | BlobProperties, **kwargs: Any) -> None
Parameters Returns acquire_lease
Requests a new lease.
If the blob does not have an active lease, the Blob Service creates a lease on the blob and returns a new lease.
acquire_lease(lease_duration: int = -1, lease_id: str | None = None, **kwargs: Any) -> BlobLeaseClient
Parameters Keyword-Only Parameters Returns append_block
Commits a new block of data to the end of the existing append blob.
append_block(data: bytes | str | Iterable | IO, length: int | None = None, **kwargs: Any) -> Dict[str, str | datetime | int]
Parameters Keyword-Only Parameters Returns append_block_from_url
Creates a new block to be committed as part of a blob, where the contents are read from a source url.
append_block_from_url(copy_source_url: str, source_offset: int | None = None, source_length: int | None = None, **kwargs: Any) -> Dict[str, str | datetime | int]
Parameters Keyword-Only Parameters Returns clear_page
Clears a range of pages.
clear_page(offset: int, length: int, **kwargs: Any) -> Dict[str, str | datetime]
Parameters Keyword-Only Parameters Returns close
This method is to close the sockets opened by the client. It need not be used when using with a context manager.
close()
commit_block_list
The Commit Block List operation writes a blob by specifying the list of block IDs that make up the blob.
commit_block_list(block_list: List[BlobBlock], content_settings: ContentSettings | None = None, metadata: Dict[str, str] | None = None, **kwargs: Any) -> Dict[str, str | datetime]
Parameters Keyword-Only Parameters Returns create_append_blob
Creates a new Append Blob. This operation creates a new 0-length append blob. The content of any existing blob is overwritten with the newly initialized append blob. To add content to the append blob, call the append_block or append_block_from_url method.
create_append_blob(content_settings: ContentSettings | None = None, metadata: Dict[str, str] | None = None, **kwargs: Any) -> Dict[str, str | datetime]
Parameters Keyword-Only Parameters Returns create_page_blob
Creates a new Page Blob of the specified size.
create_page_blob(size: int, content_settings: ContentSettings | None = None, metadata: Dict[str, str] | None = None, premium_page_blob_tier: str | PremiumPageBlobTier | None = None, **kwargs: Any) -> Dict[str, str | datetime]
Parameters Keyword-Only Parameters Returns create_snapshot
Creates a snapshot of the blob.
A snapshot is a read-only version of a blob that's taken at a point in time. It can be read, copied, or deleted, but not modified. Snapshots provide a way to back up a blob as it appears at a moment in time.
A snapshot of a blob has the same name as the base blob from which the snapshot is taken, with a DateTime value appended to indicate the time at which the snapshot was taken.
create_snapshot(metadata: Dict[str, str] | None = None, **kwargs: Any) -> Dict[str, str | datetime]
Parameters Keyword-Only Parameters Returns delete_blob
Marks the specified blob for deletion.
The blob is later deleted during garbage collection. Note that in order to delete a blob, you must delete all of its snapshots. You can delete both at the same time with the delete_blob() operation.
If a delete retention policy is enabled for the service, then this operation soft deletes the blob and retains the blob for a specified number of days. After the specified number of days, the blob's data is removed from the service during garbage collection. Soft deleted blob is accessible through list_blobs specifying include=['deleted'] option. Soft-deleted blob can be restored using <xref:azure.storage.blob.undelete> operation.
delete_blob(delete_snapshots: str | None = None, **kwargs: Any) -> None
Parameters Keyword-Only Parameters Returns delete_immutability_policy
The Delete Immutability Policy operation deletes the immutability policy on the blob.
New in version 12.10.0: This operation was introduced in API version '2020-10-02'.
delete_immutability_policy(**kwargs: Any) -> None
Keyword-Only Parameters Returns download_blob
Downloads a blob to the StorageStreamDownloader. The readall() method must be used to read all the content or readinto() must be used to download the blob into a stream. Using chunks() returns an iterator which allows the user to iterate over the content in chunks.
download_blob(offset: int | None = None, length: int | None = None, *, encoding: str, **kwargs: Any) -> StorageStreamDownloader[str]
Parameters Keyword-Only Parameters Returns exists
Returns True if a blob exists with the defined parameters, and returns False otherwise.
exists(**kwargs: Any) -> bool
Keyword-Only Parameters Returns from_blob_url
Create BlobClient from a blob url. This doesn't support customized blob url with '/' in blob name.
from_blob_url(blob_url: str, credential: str | Dict[str, str] | AzureNamedKeyCredential | AzureSasCredential | TokenCredential | None = None, snapshot: str | Dict[str, Any] | None = None, **kwargs: Any) -> Self
Parameters Keyword-Only Parameters Returns from_connection_string
Create BlobClient from a Connection String.
from_connection_string(conn_str: str, container_name: str, blob_name: str, snapshot: str | Dict[str, Any] | None = None, credential: str | Dict[str, str] | AzureNamedKeyCredential | AzureSasCredential | TokenCredential | None = None, **kwargs: Any) -> Self
Parameters Keyword-Only Parameters Returns get_account_information
Gets information related to the storage account in which the blob resides.
The information can also be retrieved if the user has a SAS to a container or blob. The keys in the returned dictionary include 'sku_name' and 'account_kind'.
get_account_information(**kwargs: Any) -> Dict[str, str]
Returns get_blob_properties
Returns all user-defined metadata, standard HTTP properties, and system properties for the blob. It does not return the content of the blob.
get_blob_properties(**kwargs: Any) -> BlobProperties
Keyword-Only Parameters Returns get_blob_tags
The Get Tags operation enables users to get tags on a blob or specific blob version, or snapshot.
New in version 12.4.0: This operation was introduced in API version '2019-12-12'.
get_blob_tags(**kwargs: Any) -> Dict[str, str]
Keyword-Only Parameters Returns get_block_list
The Get Block List operation retrieves the list of blocks that have been uploaded as part of a block blob.
get_block_list(block_list_type: str = 'committed', **kwargs: Any) -> Tuple[List[BlobBlock], List[BlobBlock]]
Parameters Keyword-Only Parameters Returns get_page_range_diff_for_managed_disk
Returns the list of valid page ranges for a managed disk or snapshot.
Note
This operation is only available for managed disk accounts.
New in version 12.2.0: This operation was introduced in API version '2019-07-07'.
get_page_range_diff_for_managed_disk(previous_snapshot_url: str, offset: int | None = None, length: int | None = None, **kwargs: Any) -> Tuple[List[Dict[str, int]], List[Dict[str, int]]]
Parameters Keyword-Only Parameters Returns get_page_ranges
DEPRECATED: Returns the list of valid page ranges for a Page Blob or snapshot of a page blob.
get_page_ranges(offset: int | None = None, length: int | None = None, previous_snapshot_diff: str | Dict[str, Any] | None = None, **kwargs: Any) -> Tuple[List[Dict[str, int]], List[Dict[str, int]]]
Parameters Keyword-Only Parameters Returns list_page_ranges
Returns the list of valid page ranges for a Page Blob or snapshot of a page blob. If previous_snapshot is specified, the result will be a diff of changes between the target blob and the previous snapshot.
list_page_ranges(*, offset: int | None = None, length: int | None = None, previous_snapshot: str | Dict[str, Any] | None = None, **kwargs: Any) -> ItemPaged[PageRange]
Keyword-Only Parameters Returns query_blob
Enables users to select/project on blob/or blob snapshot data by providing simple query expressions. This operations returns a BlobQueryReader, users need to use readall() or readinto() to get query data.
query_blob(query_expression: str, **kwargs: Any) -> BlobQueryReader
Parameters Keyword-Only Parameters Returns resize_blob
Resizes a page blob to the specified size.
If the specified value is less than the current size of the blob, then all pages above the specified value are cleared.
resize_blob(size: int, **kwargs: Any) -> Dict[str, str | datetime]
Parameters Keyword-Only Parameters Returns seal_append_blob
The Seal operation seals the Append Blob to make it read-only.
New in version 12.4.0.
seal_append_blob(**kwargs: Any) -> Dict[str, str | datetime | int]
Keyword-Only Parameters Returns set_blob_metadata
Sets user-defined metadata for the blob as one or more name-value pairs.
set_blob_metadata(metadata: Dict[str, str] | None = None, **kwargs: Any) -> Dict[str, str | datetime]
Parameters Keyword-Only Parameters Returns set_blob_tags
The Set Tags operation enables users to set tags on a blob or specific blob version, but not snapshot. Each call to this operation replaces all existing tags attached to the blob. To remove all tags from the blob, call this operation with no tags set.
New in version 12.4.0: This operation was introduced in API version '2019-12-12'.
set_blob_tags(tags: Dict[str, str] | None = None, **kwargs: Any) -> Dict[str, Any]
Parameters Keyword-Only Parameters Returns
Sets system properties on the blob.
If one property is set for the content_settings, all properties will be overridden.
set_http_headers(content_settings: ContentSettings | None = None, **kwargs: Any) -> Dict[str, Any]
Parameters Keyword-Only Parameters Returns set_immutability_policy
The Set Immutability Policy operation sets the immutability policy on the blob.
New in version 12.10.0: This operation was introduced in API version '2020-10-02'.
set_immutability_policy(immutability_policy: ImmutabilityPolicy, **kwargs: Any) -> Dict[str, str]
Parameters Keyword-Only Parameters Returns set_legal_hold
The Set Legal Hold operation sets a legal hold on the blob.
New in version 12.10.0: This operation was introduced in API version '2020-10-02'.
set_legal_hold(legal_hold: bool, **kwargs: Any) -> Dict[str, str | datetime | bool]
Parameters Keyword-Only Parameters Returns set_premium_page_blob_tier
Sets the page blob tiers on the blob. This API is only supported for page blobs on premium accounts.
set_premium_page_blob_tier(premium_page_blob_tier: PremiumPageBlobTier, **kwargs: Any) -> None
Parameters Keyword-Only Parameters Returns set_sequence_number
Sets the blob sequence number.
set_sequence_number(sequence_number_action: str | SequenceNumberAction, sequence_number: str | None = None, **kwargs: Any) -> Dict[str, str | datetime]
Parameters Keyword-Only Parameters Returns set_standard_blob_tier
This operation sets the tier on a block blob.
A block blob's tier determines Hot/Cool/Archive storage type. This operation does not update the blob's ETag.
set_standard_blob_tier(standard_blob_tier: str | StandardBlobTier, **kwargs: Any) -> None
Parameters Keyword-Only Parameters Returns stage_block
Creates a new block to be committed as part of a blob.
stage_block(block_id: str, data: bytes | str | Iterable | IO, length: int | None = None, **kwargs: Any) -> Dict[str, Any]
Parameters Keyword-Only Parameters Returns stage_block_from_url
Creates a new block to be committed as part of a blob where the contents are read from a URL.
stage_block_from_url(block_id: str, source_url: str, source_offset: int | None = None, source_length: int | None = None, source_content_md5: bytes | bytearray | None = None, **kwargs: Any) -> Dict[str, Any]
Parameters Keyword-Only Parameters Returns start_copy_from_url
Copies a blob from the given URL.
This operation returns a dictionary containing copy_status and copy_id, which can be used to check the status of or abort the copy operation. copy_status will be 'success' if the copy completed synchronously or 'pending' if the copy has been started asynchronously. For asynchronous copies, the status can be checked by polling the get_blob_properties method and checking the copy status. Set requires_sync to True to force the copy to be synchronous. The Blob service copies blobs on a best-effort basis.
The source blob for a copy operation may be a block blob, an append blob, or a page blob. If the destination blob already exists, it must be of the same blob type as the source blob. Any existing destination blob will be overwritten. The destination blob cannot be modified while a copy operation is in progress.
When copying from a page blob, the Blob service creates a destination page blob of the source blob's length, initially containing all zeroes. Then the source page ranges are enumerated, and non-empty ranges are copied.
For a block blob or an append blob, the Blob service creates a committed blob of zero length before returning from this operation. When copying from a block blob, all committed blocks and their block IDs are copied. Uncommitted blocks are not copied. At the end of the copy operation, the destination blob will have the same committed block count as the source.
When copying from an append blob, all committed blocks are copied. At the end of the copy operation, the destination blob will have the same committed block count as the source.
start_copy_from_url(source_url: str, metadata: Dict[str, str] | None = None, incremental_copy: bool = False, **kwargs: Any) -> Dict[str, str | datetime]
Parameters Keyword-Only Parameters Returns undelete_blob
Restores soft-deleted blobs or snapshots.
Operation will only be successful if used within the specified number of days set in the delete retention policy.
If blob versioning is enabled, the base blob cannot be restored using this method. Instead use start_copy_from_url with the URL of the blob version you wish to promote to the current version.
undelete_blob(**kwargs: Any) -> None
Keyword-Only Parameters Returns upload_blob
Creates a new blob from a data source with automatic chunking.
upload_blob(data: bytes | str | Iterable | IO[bytes], blob_type: str | BlobType = BlobType.BLOCKBLOB, length: int | None = None, metadata: Dict[str, str] | None = None, **kwargs: Any) -> Dict[str, Any]
Parameters Keyword-Only Parameters Returns upload_blob_from_url
Creates a new Block Blob where the content of the blob is read from a given URL. The content of an existing blob is overwritten with the new blob.
upload_blob_from_url(source_url: str, *, metadata: Dict[str, str] | None = None, **kwargs: Any) -> Dict[str, Any]
Parameters Keyword-Only Parameters Returns upload_page
The Upload Pages operation writes a range of pages to a page blob.
upload_page(page: bytes, offset: int, length: int, **kwargs: Any) -> Dict[str, str | datetime]
Parameters Keyword-Only Parameters Returns upload_pages_from_url
The Upload Pages operation writes a range of pages to a page blob where the contents are read from a URL.
upload_pages_from_url(source_url: str, offset: int, length: int, source_offset: int, **kwargs: Any) -> Dict[str, Any]
Parameters Keyword-Only Parameters Returns Attributes api_version
The version of the Storage API used for requests.
Returns location_modeThe location mode that the client is currently using.
By default this will be "primary". Options include "primary" and "secondary".
Returns primary_endpointThe full primary endpoint URL.
Returns primary_hostnameThe hostname of the primary endpoint.
Returns secondary_endpointThe full secondary endpoint URL if configured.
If not available a ValueError will be raised. To explicitly specify a secondary hostname, use the optional secondary_hostname keyword argument on instantiation.
Returns Exceptions secondary_hostnameThe hostname of the secondary endpoint.
If not available this will be None. To explicitly specify a secondary hostname, use the optional secondary_hostname keyword argument on instantiation.
Returns urlThe full endpoint URL to this entity, including SAS token if used.
This could be either the primary endpoint, or the secondary endpoint depending on the current location_mode. :returns: The full endpoint URL to this entity, including SAS token if used. :rtype: str
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4