From 54d1ce0742d246f468373446f155bc2c9d624f2d Mon Sep 17 00:00:00 2001 From: mdtanker Date: Mon, 9 Dec 2024 14:21:38 -0500 Subject: [PATCH] fix: raise error if EarthData login fails --- src/polartoolkit/fetch.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/polartoolkit/fetch.py b/src/polartoolkit/fetch.py index 49ee46ae..012a5da1 100644 --- a/src/polartoolkit/fetch.py +++ b/src/polartoolkit/fetch.py @@ -236,7 +236,15 @@ class EarthDataDownloader: """ def __init__(self) -> None: - earthaccess.login() + auth = earthaccess.login() + auth = earthaccess.__auth__ + + if auth.authenticated is False: + msg = ( + "EarthData login failed, please check your Username and Password are " + "correct" + ) + raise ValueError(msg) def __call__(self, url: str, output_file: str, dataset: typing.Any) -> None: creds = earthaccess.auth_environ()