Skip to content

Commit

Permalink
fix: raise error if EarthData login fails
Browse files Browse the repository at this point in the history
  • Loading branch information
mdtanker committed Dec 9, 2024
1 parent 8307a5f commit 54d1ce0
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/polartoolkit/fetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,15 @@ class EarthDataDownloader:
"""

def __init__(self) -> None:
earthaccess.login()
auth = earthaccess.login()
auth = earthaccess.__auth__

Check warning on line 240 in src/polartoolkit/fetch.py

View check run for this annotation

Codecov / codecov/patch

src/polartoolkit/fetch.py#L239-L240

Added lines #L239 - L240 were not covered by tests

if auth.authenticated is False:
msg = (

Check warning on line 243 in src/polartoolkit/fetch.py

View check run for this annotation

Codecov / codecov/patch

src/polartoolkit/fetch.py#L242-L243

Added lines #L242 - L243 were not covered by tests
"EarthData login failed, please check your Username and Password are "
"correct"
)
raise ValueError(msg)

Check warning on line 247 in src/polartoolkit/fetch.py

View check run for this annotation

Codecov / codecov/patch

src/polartoolkit/fetch.py#L247

Added line #L247 was not covered by tests

def __call__(self, url: str, output_file: str, dataset: typing.Any) -> None:
creds = earthaccess.auth_environ()
Expand Down

0 comments on commit 54d1ce0

Please sign in to comment.