in airavata_django_portal_sdk/user_storage/api.py [0:0]
def get_download_url(request, data_product=None, data_product_uri=None, force_download=False, mime_type=None):
"Return URL for downloading data product. One of `data_product` or `data_product_uri` is required."
if data_product is None:
data_product = _get_data_product(request, data_product_uri)
if remoteapi.is_remote_api_configured():
# Build a local /sdk/download-file URL that will stream the file from the remote server
return _build_download_url(request, data_product, force_download=force_download, mime_type=mime_type)
storage_resource_id, path = _get_replica_resource_id_and_filepath(data_product)
backend = get_user_storage_provider(request,
owner_username=data_product.ownerName,
storage_resource_id=storage_resource_id)
if isinstance(backend, ProvidesDownloadUrl):
return backend.get_download_url(path)
else:
# if backend doesn't provide a download url, then use default one
# that uses backend to read the file
return _build_download_url(request, data_product, force_download=force_download, mime_type=mime_type)