適用於 Python 的 Azure 儲存體程式庫Azure Storage libraries for Python
概觀Overview
- 從 Azure Blob 儲存體讀取和寫入物件及檔案Read and write objects and files from Azure Blob storage
- 使用 Azure 佇列儲存體在雲端連線的應用程式之間傳送和接收訊息Send and receive messages between cloud-connected applications with Azure Queue storage
- 使用 Azure 資料表儲存體讀取及寫入大型的結構化資料Read and write large structured data with Azure Table storage
- 使用 Azure 檔案儲存體共用應用程式之間的儲存體Share storage between apps with Azure File storage
使用管理程式庫來建立、更新和管理 Azure 儲存體帳戶,並從您的 Python 程式碼查詢及重新產生存取金鑰。Create, update, and manage Azure Storage accounts and query and regenerate access keys from your Python code with the management libraries.
安裝程式庫Install the libraries
用戶端Client
Azure 儲存體用戶端程式庫由 4 個套件組成:Blob、檔案、佇列和資料表。Azure Storage Client Libraries consist of 4 packages: Blob, File, Queue and Table. 若要安裝 Blob 套件,請執行:To install the blob package, run:
pip install azure-storage-blob
管理性Management
pip install azure-mgmt-storage
範例Example
from azure.storage.blob import BlockBlobService
blob_service = BlockBlobService(account_name, account_key)
blob_service.create_container(
'mycontainername',
public_access=PublicAccess.Blob
)
blob_service.create_blob_from_bytes(
'mycontainername',
'myblobname',
b'<center><h1>Hello World!</h1></center>',
content_settings=ContentSettings('text/html')
)
print(blob_service.make_blob_url('mycontainername', 'myblobname'))
範例Samples
在 Python 中開始使用 Azure Blob 儲存體Get started with Azure Blob Storage in Python | 在 Azure 儲存體中建立、讀取、更新、限制存取,並刪除檔案和物件。Create, read, update, restrict access, and delete files and objects in Azure Storage. |
在 Python 中開始使用 Azure 佇列儲存體Get started with Azure Queue Storage in Python | 從 Azure 儲存體佇列中插入、查看、擷取並刪除訊息。Insert, peek, retrieve and delete messages from Azure Storage queues. |
管理 Azure 儲存體帳戶Manage Azure Storage accounts | 建立、更新和刪除儲存體帳戶。Create, update , and delete storage accounts. 取出和重新產生儲存體帳戶存取金鑰。Retrieve and regenerate storage account access keys. |
深入探索可在應用程式中使用的 Python 程式碼範例。Explore more sample Python code you can use in your apps.