Skip to content

Commit

Permalink
Merge branch 'dev-luisa' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasK committed Feb 22, 2024
2 parents 985533a + b2f89d5 commit ea5ccb2
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions earthdaily/earthdatastore/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,12 +224,28 @@ def _get_client(config=None, presign_urls=True):
A PySTAC client for interacting with the Earth Data Store STAC API.
"""

if isinstance(config, tuple): # token
token, eds_url = config
logging.log(level=logging.INFO, msg="Using token to reauth")
else:
if isinstance(config, dict):
config = config.get
elif isinstance(config,str) and config.endswith('.json'):
config = json.load(open(config, "rb")).get
token, eds_url = _get_token(config, presign_urls)


if isinstance(config, dict):
if isinstance(config, tuple): # token
token, eds_url = config
logging.log(level=logging.INFO, msg="Using token to reauth")
elif isinstance(config, dict):
config = config.get
if isinstance(config, str) and config.endswith('.json'):
config = json.load(open(config, "rb")).get
token, eds_url = _get_token(config, presign_urls)
elif isinstance(config, str) and config.endswith('.json'):
config = json.load(open(config, "rb")).get
token, eds_url = _get_token(config, presign_urls)
elif config is None:
token, eds_url = _get_token(config, presign_urls)

headers = {"Authorization": f"bearer {token}"}
if presign_urls:
Expand Down

0 comments on commit ea5ccb2

Please sign in to comment.