Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle S3 credential expiration more gracefully #354

Merged
merged 6 commits into from
Nov 30, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions earthaccess/store.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,15 @@ def get_s3fs_session(
"parameters must be specified. "
)

if concept_id is not None:
provider = self._derive_concept_provider(concept_id)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯


# Get existing S3 credentials if we already have them
location = (concept_id, daac, provider, endpoint)
location = (
daac,
provider,
endpoint,
) # Identifier for where to get S3 credentials from
need_new_creds = False
try:
dt_init, creds = self._s3_credentials[location]
MattF-NSIDC marked this conversation as resolved.
Show resolved Hide resolved
Expand All @@ -228,9 +235,6 @@ def get_s3fs_session(
now = datetime.datetime.now()
if endpoint is not None:
creds = self.auth.get_s3_credentials(endpoint=endpoint)
MattF-NSIDC marked this conversation as resolved.
Show resolved Hide resolved
elif concept_id is not None:
provider = self._derive_concept_provider(concept_id)
creds = self.auth.get_s3_credentials(provider=provider)
elif daac is not None:
creds = self.auth.get_s3_credentials(daac=daac)
elif provider is not None:
Expand Down
Loading