From 7c5e027d7bc9888f93c2cb8a0c7b211554bb59f8 Mon Sep 17 00:00:00 2001 From: jessicas11 Date: Tue, 6 Feb 2024 19:17:21 +0000 Subject: [PATCH] change api to error --- binder/environment.yml | 1 + earthaccess/api.py | 7 ++++--- earthaccess/store.py | 4 +--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/binder/environment.yml b/binder/environment.yml index 2bc59969..c59ef68d 100644 --- a/binder/environment.yml +++ b/binder/environment.yml @@ -2,6 +2,7 @@ name: earthaccess channels: - conda-forge dependencies: + - boto3 - python=3.9 - xarray>=0.19 - dask>=2022.1 diff --git a/earthaccess/api.py b/earthaccess/api.py index ca57a820..678698b0 100644 --- a/earthaccess/api.py +++ b/earthaccess/api.py @@ -371,7 +371,8 @@ def in_us_west_2() -> str: str: string indicating if the user is in AWS region us-west-2 """ if earthaccess.__store__._running_in_us_west_2() is True: - msg = "You are running in AWS region 'us-west-2'" + return "You are running in AWS region 'us-west-2'" else: - msg = "You are not running in AWS region 'us-west-2'" - return msg + raise ValueError('Your instance is not running inside the' + ' AWS us-west-2 region.' + ' You will not be able to directly access NASA Earthdata S3 buckets') diff --git a/earthaccess/store.py b/earthaccess/store.py index 3d693bf8..37c4c77a 100644 --- a/earthaccess/store.py +++ b/earthaccess/store.py @@ -144,9 +144,7 @@ def _running_in_us_west_2(self) -> bool: if (boto3.client('s3').meta.region_name == 'us-west-2'): return True else: - raise ValueError('Your instance is not running inside the' - ' AWS us-west-2 region.' - ' You will not be able to directly access NASA Earthdata S3 buckets') + return False def set_requests_session( self, url: str, method: str = "get", bearer_token: bool = False