pypicloud.storage.azure_blob module

Store packages in Azure Blob Storage

class pypicloud.storage.azure_blob.AzureBlobStorage(request, expire_after=None, path_prefix=None, redirect_urls=None, storage_account_name=None, storage_account_key=None, storage_container_name=None)[source]

Bases: IStorage

Storage backend that uses Azure Blob Storage

check_health()[source]

Check the health of the storage backend

Returns
(healthy, status)(bool, str)

Tuple that describes the health status and provides an optional status message

classmethod configure(settings)[source]

Configure the storage method with app settings

delete(package)[source]

Delete a package file

Parameters
packagePackage

The package metadata

download_response(package)[source]

Return a HTTP Response that will download this package

This is called from the download endpoint

get_path(package)[source]

Get the fully-qualified bucket path for a package

list(factory=<class 'pypicloud.models.Package'>)[source]

Return a list or generator of all packages

open(package)[source]

Get a buffer object that can read the package data

This should be a context manager. It is used in migration scripts, not directly by the web application.

Parameters
packagePackage

Examples

with storage.open(package) as pkg_data:
    with open('outfile.tar.gz', 'w') as ofile:
        ofile.write(pkg_data.read())
test = False[source]
upload(package, datastream)[source]

Upload a package file to the storage backend

Parameters
packagePackage

The package metadata

datastreamfile

A file-like object that contains the package data