in airavata_django_portal_sdk/user_storage/backends/mft_provider.py [0:0]
def get_download_url(self, resource_path):
with grpc.insecure_channel(self.mft_api_endpoint) as channel:
child_path = self._get_child_path(resource_path)
stub = MFTApi_pb2_grpc.MFTApiServiceStub(channel)
download_request = MFTApi_pb2.HttpDownloadApiRequest(
sourceResourceId=self.resource_id,
sourceResourceChildPath=child_path,
sourceToken=self.resource_token,
sourceType="SCP",
targetAgent="agent0",
mftAuthorizationToken=self.auth_token,
)
try:
response = stub.submitHttpDownload(download_request)
logger.debug(f"Download request for {self.resource_id}:{child_path}. Response = {response}")
return response.url
except Exception as e:
logger.error(f"submitHttpDownload request {download_request} failed.")
raise Exception(f"Failed to get download url for {resource_path}") from e