Azure python package for infinity team
Project description
Azure Package
Introduction
infi_azure is a comprehensive package that aims to simplify Azure operations by encapsulating core functionalities into three classes: AzureStorageAccount, AzureContainer, and AzureBlob. Additionally, it includes utility functions like azcopy to streamline the process of Azure actions.
Installation
Install the package via pipenv:
pipenv install infi_azure
Features
-
AzureStorageAccount: This class facilitates seamless interaction with Azure Storage Accounts
by providing methods for connection, retrieving account details, checking account existence, and accessing
the Blob Service Client. -
AzureContainer: This class provides features for seamless interaction with Azure Storage Blob containers,
including retrieving directories, generating Shared Access Signatures (SAS) tokens and URLs, checking container existence
and deleting blobs within a specified directory. -
AzureBlob: This class facilitates interactions with individual blobs within an Azure Storage Container,
offering functionalities such as downloading blob content as bytes, checking blob existence,
verifying if a directory is empty, creating an empty directory, and counting the number of blobs within a specified directory. -
azcopy_action: This function utilizes AzCopy to copy the contents of a source folder to a specified destination
container in Azure Blob Storage.
Usage Example
AzureStorageAccount
from azure_storage_account import AzureStorageAccount
# Replace 'your_connection_string_here' with your actual connection string
connection_string = "your_connection_string_here"
storage_account = AzureStorageAccount(connection_string)
# Check if the account exists
if storage_account.is_account_exist():
print("Azure Storage Account exists.")
else:
print("Azure Storage Account does not exist.")
AzureContainer
from azure_storage_account import AzureStorageAccount, AzureContainer
# Replace 'your_connection_string_here' with your actual connection string
connection_string = "your_connection_string_here"
storage_account = AzureStorageAccount(connection_string)
# Replace 'your_container_name' with your actual container name
container_name = "your_container_name"
container = AzureContainer(container_name, storage_account)
# print all directories in container
print(container.get_all_directories_in_container())
AzureBlob
from azure_storage_account import AzureStorageAccount, AzureContainer, AzureBlob
# Replace 'your_connection_string_here' with your actual connection string
connection_string = "your_connection_string_here"
storage_account = AzureStorageAccount(connection_string)
# Replace 'your_container_name' with your actual container name
container_name = "your_container_name"
container = AzureContainer(container_name, storage_account)
# Replace 'your_blob_name' with your actual blob name
blob_name = "your_blob_name"
blob = AzureBlob(blob_name, container)
# create empty directory
blob.create_empty_directory()
Azcopy
from azure_storage_account import azcopy_action
# Replace the parameters with your actual parameters
source = "your_source_container_url"
dest = "your_destination_container_url"
azcopy_path = "your_azcopy_path"
azcopy_action(azcopy_path, source, dest)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for infi_azure-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 85f8c20f5d0b6f71e483667a926f67939b4774ee75d1df11e5b8c783c526f2e0 |
|
MD5 | 2e338c6953f4996baa1cc3b20d4953c1 |
|
BLAKE2b-256 | ec71023fe1567298f0041e0a6b7df9e1af85bd9e82feee3c101f6b20cec8f0c2 |