Skip to content

Commit

Permalink
fix: add test case + bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
wphyojpl committed Dec 2, 2024
1 parent 20695dd commit 3957288
Show file tree
Hide file tree
Showing 2 changed files with 396 additions and 19 deletions.
12 changes: 9 additions & 3 deletions mdps_ds_lib/stage_in_out/download_granules_amalgamation.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import logging
import os

from mdps_ds_lib.lib.earthdata_login.urs_token_retriever import URSTokenRetriever
from mdps_ds_lib.stage_in_out.download_granules_abstract import DownloadGranulesAbstract
Expand Down Expand Up @@ -28,14 +29,19 @@ def _set_props_from_env(self):
return self

def download_one_item(self, downloading_url: str):
LOGGER.debug(f'downloading: {downloading_url}')
LOGGER.error(f'downloading: {downloading_url}')
upper_download_url = downloading_url.upper()
if upper_download_url.startswith('S3://'):
return DownloadGranulesS3().download_one_item(downloading_url)
download_s3 = DownloadGranulesS3()
download_s3._download_dir = self._download_dir
return download_s3.download_one_item(downloading_url)
if not upper_download_url.startswith('HTTPS://'):
raise ValueError(f'unknown URL to download: {downloading_url}')
if any([k in upper_download_url for k in DownloadGranulesDAAC.VALID_DOMAINS]):
download_daac = DownloadGranulesDAAC()
download_daac.edl_token = self.__edl_token
download_daac._download_dir = self._download_dir
return download_daac.download_one_item(downloading_url)
return DownloadGranulesHttp().download_one_item(downloading_url)
download_http = DownloadGranulesHttp()
download_http._download_dir = self._download_dir
return download_http.download_one_item(downloading_url)
Loading

0 comments on commit 3957288

Please sign in to comment.