azure.storage.blob.models module

class azure.storage.blob.models.AppendBlockProperties[source]

Bases: azure.storage.blob.models.ResourceProperties

Response for an append block request.

Variables:
  • append_offset (int) – Position to start next append.
  • committed_block_count (int) – Number of committed append blocks.
class azure.storage.blob.models.Blob(name=None, snapshot=None, content=None, props=None, metadata=None)[source]

Bases: object

Blob class.

Variables:
  • name (str) – Name of blob.
  • snapshot (str) – A DateTime value that uniquely identifies the snapshot. The value of this header indicates the snapshot version, and may be used in subsequent requests to access the snapshot.
  • content (str or bytes) – Blob content.
  • properties (BlobProperties) – Stores all the system properties for the blob.
  • metadata – Name-value pairs associated with the blob as metadata.
class azure.storage.blob.models.BlobBlock(id=None, state='Latest')[source]

Bases: object

BlockBlob Block class.

Variables:
  • id (str) – Block id.
  • state (str) – Block state. Possible valuse: committed|uncommitted
  • size (int) – Block size in bytes.
class azure.storage.blob.models.BlobBlockList[source]

Bases: object

Blob Block List class.

Variables:
  • committed_blocks (list of BlobBlock) – List of committed blocks.
  • uncommitted_blocks (list of BlobBlock) – List of uncommitted blocks.
class azure.storage.blob.models.BlobBlockState[source]

Bases: object

Block blob block types.

Committed = 'Committed'

Committed blocks.

Latest = 'Latest'

Latest blocks.

Uncommitted = 'Uncommitted'

Uncommitted blocks.

class azure.storage.blob.models.BlobPermissions(read=False, add=False, create=False, write=False, delete=False, _str=None)[source]

Bases: object

BlobPermissions class to be used with generate_blob_shared_access_signature() API.

Variables:
Parameters:
  • read (bool) – Read the content, properties, metadata and block list. Use the blob as the source of a copy operation.
  • add (bool) – Add a block to an append blob.
  • create (bool) – Write a new blob, snapshot a blob, or copy a blob to a new blob.
  • write (bool) – Create or write content, properties, metadata, or block list. Snapshot or lease the blob. Resize the blob (page blob only). Use the blob as the destination of a copy operation within the same account.
  • delete (bool) – Delete the blob.
  • _str (str) – A string representing the permissions.
ADD = <azure.storage.blob.models.BlobPermissions object>
CREATE = <azure.storage.blob.models.BlobPermissions object>
DELETE = <azure.storage.blob.models.BlobPermissions object>
READ = <azure.storage.blob.models.BlobPermissions object>
WRITE = <azure.storage.blob.models.BlobPermissions object>
class azure.storage.blob.models.BlobPrefix[source]

Bases: object

BlobPrefix objects may potentially returned in the blob list when list_blobs() is used with a delimiter. Prefixes can be thought of as virtual blob directories.

Variables:name (str) – The name of the blob prefix.
class azure.storage.blob.models.BlobProperties[source]

Bases: object

Blob Properties

Variables:
  • blob_type (str) – String indicating this blob’s type.
  • last_modified (datetime) – A datetime object representing the last time the blob was modified.
  • etag (str) – The ETag contains a value that you can use to perform operations conditionally.
  • content_length (int) – The length of the content returned. If the entire blob was requested, the length of blob in bytes. If a subset of the blob was requested, the length of the returned subset.
  • content_range (str) – Indicates the range of bytes returned in the event that the client requested a subset of the blob.
  • append_blob_committed_block_count (int) – (For Append Blobs) Number of committed blocks in the blob.
  • page_blob_sequence_number (int) – (For Page Blobs) Sequence number for page blob used for coordinating concurrent writes.
  • server_encrypted (bool) – Set to true if the blob is encrypted on the server.
  • copy (CopyProperties) – Stores all the copy properties for the blob.
  • content_settings (ContentSettings) – Stores all the content settings for the blob.
  • lease (LeaseProperties) – Stores all the lease information for the blob.
class azure.storage.blob.models.BlockListType[source]

Bases: object

Specifies whether to return the list of committed blocks, the list of uncommitted blocks, or both lists together.

All = 'all'

Both committed and uncommitted blocks.

Committed = 'committed'

Committed blocks.

Uncommitted = 'uncommitted'

Uncommitted blocks.

class azure.storage.blob.models.Container(name=None, props=None, metadata=None)[source]

Bases: object

Blob container class.

Variables:
  • name (str) – The name of the container.
  • metadata (dict mapping str to str) – A dict containing name-value pairs associated with the container as metadata. This var is set to None unless the include=metadata param was included for the list containers operation. If this parameter was specified but the container has no metadata, metadata will be set to an empty dictionary.
  • properties (ContainerProperties) – System properties for the container.
class azure.storage.blob.models.ContainerPermissions(read=False, write=False, delete=False, list=False, _str=None)[source]

Bases: object

ContainerPermissions class to be used with generate_container_shared_access_signature() API and for the AccessPolicies used with set_container_acl().

Variables:
  • ContainerPermissions.DELETE (ContainerPermissions) – Delete any blob in the container. Note: You cannot grant permissions to delete a container with a container SAS. Use an account SAS instead.
  • ContainerPermissions.LIST (ContainerPermissions) – List blobs in the container.
  • ContainerPermissions.READ (ContainerPermissions) – Read the content, properties, metadata or block list of any blob in the container. Use any blob in the container as the source of a copy operation.
  • ContainerPermissions.WRITE (ContainerPermissions) – For any blob in the container, create or write content, properties, metadata, or block list. Snapshot or lease the blob. Resize the blob (page blob only). Use the blob as the destination of a copy operation within the same account. Note: You cannot grant permissions to read or write container properties or metadata, nor to lease a container, with a container SAS. Use an account SAS instead.
Parameters:
  • read (bool) – Read the content, properties, metadata or block list of any blob in the container. Use any blob in the container as the source of a copy operation.
  • write (bool) – For any blob in the container, create or write content, properties, metadata, or block list. Snapshot or lease the blob. Resize the blob (page blob only). Use the blob as the destination of a copy operation within the same account. Note: You cannot grant permissions to read or write container properties or metadata, nor to lease a container, with a container SAS. Use an account SAS instead.
  • delete (bool) – Delete any blob in the container. Note: You cannot grant permissions to delete a container with a container SAS. Use an account SAS instead.
  • list (bool) – List blobs in the container.
  • _str (str) – A string representing the permissions.
DELETE = <azure.storage.blob.models.ContainerPermissions object>
LIST = <azure.storage.blob.models.ContainerPermissions object>
READ = <azure.storage.blob.models.ContainerPermissions object>
WRITE = <azure.storage.blob.models.ContainerPermissions object>
class azure.storage.blob.models.ContainerProperties[source]

Bases: object

Blob container’s properties class.

Variables:
  • last_modified (datetime) – A datetime object representing the last time the container was modified.
  • etag (str) – The ETag contains a value that you can use to perform operations conditionally.
  • lease (LeaseProperties) – Stores all the lease information for the container.
class azure.storage.blob.models.ContentSettings(content_type=None, content_encoding=None, content_language=None, content_disposition=None, cache_control=None, content_md5=None)[source]

Bases: object

Used to store the content settings of a blob.

Variables:
  • content_type (str) – The content type specified for the blob. If no content type was specified, the default content type is application/octet-stream.
  • content_encoding (str) – If the content_encoding has previously been set for the blob, that value is stored.
  • content_language (str) – If the content_language has previously been set for the blob, that value is stored.
  • content_disposition (str) – content_disposition conveys additional information about how to process the response payload, and also can be used to attach additional metadata. If content_disposition has previously been set for the blob, that value is stored.
  • cache_control (str) – If the cache_control has previously been set for the blob, that value is stored.
  • content_md5 (str) – If the content_md5 has been set for the blob, this response header is stored so that the client can check for message content integrity.
class azure.storage.blob.models.CopyProperties[source]

Bases: object

Blob Copy Properties.

Variables:
  • id (str) – String identifier for the last attempted Copy Blob operation where this blob was the destination blob. This header does not appear if this blob has never been the destination in a Copy Blob operation, or if this blob has been modified after a concluded Copy Blob operation using Set Blob Properties, Put Blob, or Put Block List.
  • source (str) – URL up to 2 KB in length that specifies the source blob used in the last attempted Copy Blob operation where this blob was the destination blob. This header does not appear if this blob has never been the destination in a Copy Blob operation, or if this blob has been modified after a concluded Copy Blob operation using Set Blob Properties, Put Blob, or Put Block List.
  • status (str) –
    State of the copy operation identified by Copy ID, with these values:
    success:
    Copy completed successfully.
    pending:
    Copy is in progress. Check copy_status_description if intermittent, non-fatal errors impede copy progress but don’t cause failure.
    aborted:
    Copy was ended by Abort Copy Blob.
    failed:
    Copy failed. See copy_status_description for failure details.
  • progress (str) – Contains the number of bytes copied and the total bytes in the source in the last attempted Copy Blob operation where this blob was the destination blob. Can show between 0 and Content-Length bytes copied.
  • completion_time (datetime) – Conclusion time of the last attempted Copy Blob operation where this blob was the destination blob. This value can specify the time of a completed, aborted, or failed copy attempt.
  • status_description (str) – only appears when x-ms-copy-status is failed or pending. Describes cause of fatal or non-fatal copy operation failure.
class azure.storage.blob.models.DeleteSnapshot[source]

Bases: object

Required if the blob has associated snapshots. Specifies how to handle the snapshots.

Include = 'include'

Delete the base blob and all of its snapshots.

Only = 'only'

Delete only the blob’s snapshots and not the blob itself.

class azure.storage.blob.models.Include(snapshots=False, metadata=False, uncommitted_blobs=False, copy=False, _str=None)[source]

Bases: object

Specifies the datasets to include in the blob list response.

Variables:
  • Include.COPY (Include) – Specifies that metadata related to any current or previous Copy Blob operation should be included in the response.
  • Include.METADATA (Include) – Specifies that metadata be returned in the response.
  • Include.SNAPSHOTS (Include) – Specifies that snapshots should be included in the enumeration.
  • Include.UNCOMMITTED_BLOBS (Include) – Specifies that blobs for which blocks have been uploaded, but which have not been committed using Put Block List, be included in the response.
Parameters:
  • snapshots (bool) – Specifies that snapshots should be included in the enumeration.
  • metadata (bool) – Specifies that metadata be returned in the response.
  • uncommitted_blobs (bool) – Specifies that blobs for which blocks have been uploaded, but which have not been committed using Put Block List, be included in the response.
  • copy (bool) – Specifies that metadata related to any current or previous Copy Blob operation should be included in the response.
  • _str (str) – A string representing the includes.
COPY = <azure.storage.blob.models.Include object>
METADATA = <azure.storage.blob.models.Include object>
SNAPSHOTS = <azure.storage.blob.models.Include object>
UNCOMMITTED_BLOBS = <azure.storage.blob.models.Include object>
class azure.storage.blob.models.LeaseProperties[source]

Bases: object

Blob Lease Properties.

Variables:
  • status (str) – The lease status of the blob.
  • state (str) – Lease state of the blob. Possible values: pending|success|aborted|failed
  • duration (str) – When a blob is leased, specifies whether the lease is of infinite or fixed duration.
class azure.storage.blob.models.PageBlobProperties[source]

Bases: azure.storage.blob.models.ResourceProperties

Response for a page request.

Variables:sequence_number (int) – Identifer for page blobs to help handle concurrent writes.
class azure.storage.blob.models.PageRange(start=None, end=None, is_cleared=False)[source]

Bases: object

Page Range for page blob.

Variables:
  • start (int) – Start of page range in bytes.
  • end (int) – End of page range in bytes.
  • is_cleared (bool) – Indicates if a page range is cleared or not. Only applicable for get_page_range_diff API.
class azure.storage.blob.models.PublicAccess[source]

Bases: object

Specifies whether data in the container may be accessed publicly and the level of access.

Blob = 'blob'

Specifies public read access for blobs. Blob data within this container can be read via anonymous request, but container data is not available. Clients cannot enumerate blobs within the container via anonymous request.

Container = 'container'

Specifies full public read access for container and blob data. Clients can enumerate blobs within the container via anonymous request, but cannot enumerate containers within the storage account.

OFF = 'off'

Specifies that there is no public read access for both the container and blobs within the container. Clients cannot enumerate the containers within the storage account as well as the blobs within the container.

class azure.storage.blob.models.ResourceProperties[source]

Bases: object

Base response for a resource request.

Variables:
  • etag (str) – Opaque etag value that can be used to check if resource has been modified.
  • last_modified (datetime) – Datetime for last time resource was modified.
class azure.storage.blob.models.SequenceNumberAction[source]

Bases: object

Sequence number actions.

Increment = 'increment'

Increments the value of the sequence number by 1. If specifying this option, do not include the x-ms-blob-sequence-number header.

Max = 'max'

Sets the sequence number to be the higher of the value included with the request and the value currently stored for the blob.

Update = 'update'

Sets the sequence number to the value included with the request.