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

Expose endpoint argument in get_s3fs_session top-level function #602

Open
chuckwondo opened this issue Jun 12, 2024 · 4 comments
Open

Expose endpoint argument in get_s3fs_session top-level function #602

chuckwondo opened this issue Jun 12, 2024 · 4 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@chuckwondo
Copy link
Collaborator

Per #482, there is a desire to be able to directly invoke get_s3fs_session from the top of earthaccess, like so:

earthaccess.get_s3fs_session(endpoint="https://nisar.asf.earthdatacloud.nasa.gov/s3credentials")

Currently, it is possible to do the following, but accessing __store__ is perhaps not desirable:

earthaccess.__store__.get_s3fs_session(endpoint="https://nisar.asf.earthdatacloud.nasa.gov/s3credentials")
@chuckwondo chuckwondo added enhancement New feature or request good first issue Good for newcomers labels Jun 12, 2024
@jhkennedy
Copy link
Collaborator

jhkennedy commented Jun 12, 2024

yes, this is a good idea. In the same vein, I also find this method useful and think it would be good to expose directly:

>>> earthaccess.__store__.auth.get_s3_credentials(endpoint='https://nisar.asf.earthdatacloud.nasa.gov/s3credentials')
{'accessKeyId': 'XXX',
 'secretAccessKey': 'XXX',
 'sessionToken': 'XXX',
 'expiration': '2024-06-12 20:48:21+00:00'}

and might be a nice addition to the TEA s3 credentials READMEs: https://nisar.asf.earthdatacloud.nasa.gov/s3credentialsREADME

Notably, this does not work:

>>> arthaccess.auth.Auth.get_s3_credentials(endpoint='nisar.asf.earthdatacloud.nasa.gov/s3credentials')
TypeError: Auth.get_s3_credentials() missing 1 required positional argument: 'self'

even though I think it could be provided as just a function or provided as a static method.

@JessicaS11
Copy link
Collaborator

JessicaS11 commented Jul 11, 2024

For anyone interested in working on this issue, there is currently an earthaccess.get_s3fs_session() function exposed at the top level (api.py). My understanding is this issue aims specifically to include exposure of the endpoint kwarg there.

@chuckwondo
Copy link
Collaborator Author

For anyone interested in working on this issue, there is currently an earthaccess.get_s3fs_session() function exposed at the top level (api.py). My understanding is this issue aims specifically to include exposure of the endpoint kwarg there.

Yes, sorry if my original description was confusing.

@mfisher87 mfisher87 changed the title Expose get_s3fs_session as a top-level function Expose endpoint argument in get_s3fs_session top-level function Jul 11, 2024
@mfisher87
Copy link
Member

How's this read to y'all?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
Status: 🆕 New
Development

No branches or pull requests

4 participants