msticpy.data.storage.azure_blob_storage module
Uses the Azure Python SDK to interact with Azure Blob Storage.
- class msticpy.data.storage.azure_blob_storage.AzureBlobStorage(abs_name: Optional[str] = None, connect: bool = False, abs_connection_string: Optional[str] = None)
Bases:
object
Class for interacting with Azure Blob Storage.
Initialize connector for Azure Python SDK.
- blobs(container_name: str) Optional[DataFrame]
Get a list of blobs in a container.
- Parameters
container_name (str) – The name of the container to get blobs from.
- Returns
Details of the blobs.
- Return type
pd.DataFrame
- create_container(container_name: str, **kwargs) DataFrame
Create a new container within the Azure Blob Storage account.
- Parameters
container_name (str) – The name for the new container.
kwargs (Additional container parameters can be passed as) –
- Returns
Details of the created container.
- Return type
pd.DataFrame
- delete_blob(container_name: str, blob_name: str) bool
Delete a blob from the Azure Blob Storage account.
- get_blob(container_name: str, blob_name: str) bytes
Get a blob from the Azure Blob Storage account.
- get_sas_token(container_name: str, blob_name: str, end: Optional[datetime] = None, permission: str = 'r') str
Generate a shared access string (SAS) token for a blob.
- Parameters
container_name (str) – The name of the Azure Blob Storage container that holds the blob.
blob_name (str) – The name of the blob to generate the SAS token for.
end (datetime.datetime, optional) – The datetime the SAS token should expire, by default this is 7 days from now.
permission (str, optional) – The permissions to give the SAS token, by default ‘r’ for read.
- Returns
A URI of the blob with SAS token.
- Return type