def connect(cls, resource): """Returns a connection object pointing to the endpoint associated to the received resource. """ from azure import storage as azure_storage file_info = cls.parse_remote(resource) return azure_storage.BlobService(file_info.storage)
def list(cls, path): """Return a list containing the names of the entries in the directory given by path. The list is in arbitrary order. """ output = [] path_info = cls.parse_remote(path) blob_service = azure_storage.BlobService(path_info.storage) try: blob_enum = blob_service.list_blobs(path_info.container) except azure.WindowsAzureMissingResourceError: return output for item in blob_enum: output.append(cls._BLOB_FILE.format(storage=path_info.storage, container=path_info.container, blob=item.name)) return output