Skip to content

Commit 00c2385

Browse files
committed
cloud will not be enabled automatically. raises an error if user does not have it enabled before running the cloud uri methods
1 parent fe7e232 commit 00c2385

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

astroquery/mast/observations.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -752,13 +752,12 @@ def get_cloud_uris(self, data_products, include_bucket=True, full_url=False):
752752
if data_products includes products not found in the cloud.
753753
"""
754754

755-
# Instatiate anonymous cloud access
756-
self.enable_cloud_dataset()
755+
if self._cloud_connection == None:
756+
raise RemoteServiceError('Please enable anonymous cloud access by calling `enable_cloud_dataset` method. See MAST Labs documentation for an example: https://mast-labs.stsci.io/#example-data-access-with-astroquery-observations')
757757

758-
# Query for product URIs
759758
return self._cloud_connection.get_cloud_uri_list(data_products, include_bucket, full_url)
760759

761-
def get_cloud_uri(self, data_product, include_bucket=True, full_url=False, verbose=True):
760+
def get_cloud_uri(self, data_product, include_bucket=True, full_url=False):
762761
"""
763762
For a given data product, returns the associated cloud URI.
764763
If the product is from a mission that does not support cloud access an
@@ -784,8 +783,8 @@ def get_cloud_uri(self, data_product, include_bucket=True, full_url=False, verbo
784783
found in the cloud, None is returned.
785784
"""
786785

787-
# Instatiate anonymous cloud access
788-
self.enable_cloud_dataset(verbose)
786+
if self._cloud_connection == None:
787+
raise RemoteServiceError('Please enable anonymous cloud access by calling `enable_cloud_dataset` method. See MAST Labs documentation for an example: https://mast-labs.stsci.io/#example-data-access-with-astroquery-observations')
789788

790789
# Query for product URIs
791790
return self._cloud_connection.get_cloud_uri(data_product, include_bucket, full_url)

0 commit comments

Comments
 (0)