Skip to content

Commit

Permalink
More logging
Browse files Browse the repository at this point in the history
  • Loading branch information
jrbourbeau committed Oct 13, 2023
1 parent 01fd340 commit 335ae89
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion earthaccess/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import threading
from importlib.metadata import version
from typing import Any
import logging

from .api import (
collection_query,
Expand All @@ -19,6 +20,8 @@
from .search import DataCollections, DataGranules
from .store import Store

logger = logging.getLogger(__name__)

__all__ = [
"login",
"search_datasets",
Expand Down Expand Up @@ -59,13 +62,15 @@ def __getattr__(name): # type: ignore
for strategy in ["environment", "netrc"]:
try:
_auth.login(strategy=strategy)
except Exception:
except Exception as e:
logger.debug(f"An error occurred during automatic authentication with {strategy=}: {str(e)}")
continue
else:
if not _auth.authenticated:
continue
else:
_store = Store(_auth)
logger.debug(f"Automatic authentication with {strategy=} was successful")
break
return _auth if name == "__auth__" else _store
else:
Expand Down

0 comments on commit 335ae89

Please sign in to comment.