Skip to main content

Async Python SDK for Azure Blob Storage (both block and append blobs)

Project description

Azure Blob

Installation

pip install blob-az

Authorization

The required connection string can be obtained from the Azure Portal, within the Storage account, "Access keys" tab

Environment (.env)

For convenience, you can set os.environ["BLOB_CONN_STR"]. If you do, you can skip specifying it on every call.

E.g., create a .env file:

BLOB_CONN_STR="<BLOB_CONN_STR>"

Then load it before importing

from dotenv import load_dotenv
load_dotenv()
import blob_az as bz

bz.client() # just works!

API

  • Asynchronous (everything is a coroutine)
  • Single calls or multiple using a same client:
    # single call
    await bz.list.containers(conn_str=CONN_STR) # ain't necessary with a .env file
    
    # multiple calls
    async with bz.client() as client: # idem.
        await bz.container.create("<container-name>", client=client)
        cs = await bz.list.containers(client=client)
    

Functions

blob_az
    def client(...) -> BlobServiceClient
    list
        async def containers(...) -> list[dict]
        async def blobs(...) -> list[dict]
    container
        async def create(...)
        async def delete(...)
    blob
        async def upload(...)
        async def download(...) -> bytes
        def url(...) -> str # generate SAS url for blob

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

blob-az-0.2.4.tar.gz (4.9 kB view hashes)

Uploaded Source

Built Distribution

blob_az-0.2.4-py3-none-any.whl (6.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page