From d28ee9737ff61433c9353bc8d247da254170a6b2 Mon Sep 17 00:00:00 2001 From: bsatoriu Date: Mon, 13 Nov 2023 17:16:02 -0800 Subject: [PATCH 1/6] Additional granule url options --- maap/Result.py | 11 +++++++---- test/test_CMR.py | 9 +++++++++ 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/maap/Result.py b/maap/Result.py index 8bcf2d9..4a013de 100644 --- a/maap/Result.py +++ b/maap/Result.py @@ -134,10 +134,13 @@ def _getHttpData(self, url, overwrite, dest): return dest - def getDownloadUrl(self): - """ - :return: - """ + def getDownloadUrl(self, s3=True): + return self.getS3Url() if s3 else self.getHttpUrl() + + def getHttpUrl(self): + return self._fallback + + def getS3Url(self): return self._location def getDescription(self): diff --git a/test/test_CMR.py b/test/test_CMR.py index d67f6f0..3a9ad33 100644 --- a/test/test_CMR.py +++ b/test/test_CMR.py @@ -83,3 +83,12 @@ def test_searchGranuleWithWildcards(self): readable_granule_name='*185*') self.assertTrue('concept-id' in results[0].keys()) + def test_getUrl(self): + results = self.maap.searchGranule(page_num="1", concept_id="C1214470488-ASF", sort_key="-start_date", limit=1) + + url = results[0].getHttpUrl() + self.assertTrue(url.startswith("http")) + + url = results[0].getS3Url() + self.assertTrue(url.startswith("s3")) + From c4f0baaad61d79b494c0f30f674821c977c9da9e Mon Sep 17 00:00:00 2001 From: bsatoriu Date: Mon, 13 Nov 2023 17:21:04 -0800 Subject: [PATCH 2/6] Granule url comments --- maap/Result.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/maap/Result.py b/maap/Result.py index 4a013de..012ea53 100644 --- a/maap/Result.py +++ b/maap/Result.py @@ -135,12 +135,25 @@ def _getHttpData(self, url, overwrite, dest): return dest def getDownloadUrl(self, s3=True): + """ + Get granule download url + :param s3: True returns the s3 url, False the http url + :return: + """ return self.getS3Url() if s3 else self.getHttpUrl() def getHttpUrl(self): + """ + Get granule http url + :return: + """ return self._fallback def getS3Url(self): + """ + Get granule s3 url + :return: + """ return self._location def getDescription(self): From 2248cdb791e3fdd15761f7ab20d7e31161baf7e7 Mon Sep 17 00:00:00 2001 From: grallewellyn Date: Thu, 21 Dec 2023 17:43:16 -0800 Subject: [PATCH 3/6] removed the packages from setup.py that are probably causing cryptography errors --- setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 167170f..3017539 100644 --- a/setup.py +++ b/setup.py @@ -22,8 +22,8 @@ ] _description = 'maapPy Python API' _download_url = '' -_requirements = ["backoff", "boto3", "ConfigParser", "ipython", "mapboxgl", "moto", "mypy_boto3_s3", "pytest", - "PyYAML", "requests", "responses", "setuptools"] +_requirements = ["backoff", "boto3", "ConfigParser", "ipython", "mapboxgl", "pytest", + "PyYAML", "responses", "setuptools"] _keywords = ['dataset', 'granule', 'nasa', 'MAAP', 'CMR'] _license = 'Apache License, Version 2.0' _long_description = 'Python client API for interacting with the NASA MAAP API' From 327e871e19975d02cb62609e0a70f82ab0841974 Mon Sep 17 00:00:00 2001 From: grallewellyn Date: Fri, 22 Dec 2023 09:08:21 -0800 Subject: [PATCH 4/6] added back in other dependencies but removed ipython --- setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 3017539..c68bbef 100644 --- a/setup.py +++ b/setup.py @@ -22,8 +22,8 @@ ] _description = 'maapPy Python API' _download_url = '' -_requirements = ["backoff", "boto3", "ConfigParser", "ipython", "mapboxgl", "pytest", - "PyYAML", "responses", "setuptools"] +_requirements = ["backoff", "boto3", "ConfigParser", "mapboxgl", "moto", "mypy_boto3_s3", "pytest", + "PyYAML", "requests", "responses", "setuptools"] _keywords = ['dataset', 'granule', 'nasa', 'MAAP', 'CMR'] _license = 'Apache License, Version 2.0' _long_description = 'Python client API for interacting with the NASA MAAP API' From 6e69ff98b29b28bf3fb9af6a71da7a029d92b105 Mon Sep 17 00:00:00 2001 From: grallewellyn Date: Fri, 22 Dec 2023 10:11:08 -0800 Subject: [PATCH 5/6] updated version of ipython --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index c68bbef..375d6f6 100644 --- a/setup.py +++ b/setup.py @@ -22,7 +22,7 @@ ] _description = 'maapPy Python API' _download_url = '' -_requirements = ["backoff", "boto3", "ConfigParser", "mapboxgl", "moto", "mypy_boto3_s3", "pytest", +_requirements = ["backoff", "boto3", "ConfigParser", "ipython==8.12.0", "mapboxgl", "moto", "mypy_boto3_s3", "pytest", "PyYAML", "requests", "responses", "setuptools"] _keywords = ['dataset', 'granule', 'nasa', 'MAAP', 'CMR'] _license = 'Apache License, Version 2.0' From 63e9a222eadbb10d6f40375f28f9e75fcfc10eca Mon Sep 17 00:00:00 2001 From: grallewellyn Date: Wed, 27 Dec 2023 08:12:00 -0800 Subject: [PATCH 6/6] pinned version of boto3 to 1.33.13 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 375d6f6..5067d6d 100644 --- a/setup.py +++ b/setup.py @@ -22,7 +22,7 @@ ] _description = 'maapPy Python API' _download_url = '' -_requirements = ["backoff", "boto3", "ConfigParser", "ipython==8.12.0", "mapboxgl", "moto", "mypy_boto3_s3", "pytest", +_requirements = ["backoff", "boto3==1.33.13", "ConfigParser", "ipython==8.12.0", "mapboxgl", "moto", "mypy_boto3_s3", "pytest", "PyYAML", "requests", "responses", "setuptools"] _keywords = ['dataset', 'granule', 'nasa', 'MAAP', 'CMR'] _license = 'Apache License, Version 2.0'