Skip to main content

Async Python SDK for Azure Blob Storage (Block and Append blocks supported)

Project description

Azure Blob

Authorization

Both required fields can be obtained from the Azure Portal, within the Storage account, "Access keys" tab:

  • BLOB_CONN_STR (Connection string in the portal)
  • BLOB_KEY (KEY in the portal): <random base64 string>

Environment (.env)

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

E.g., create a .env file:

BLOB_CONN_STR="<BLOB_CONN_STR>"
BLOB_KEY="<BLOB_KEY>"

Then load it before importing

from dotenv import load_dotenv
load_dotenv()
import blob_az as azb

azb.client() # just works!

API

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

Functions

az_blob
    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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

blob_az-0.1.2-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file blob_az-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: blob_az-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for blob_az-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5ef1d073af7fd33c0e3ebb6ee8392923ded929a2779aecacc7a45c0944e6b3ce
MD5 b6b493ee5ad73dbabd59470651b5223f
BLAKE2b-256 87e6c6463732681eaf9f546d6d5ebbd4629ecb555f908399a558d39b17203bb9

See more details on using hashes here.

Supported by

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