Define a client/session object #1004
Replies: 2 comments 1 reply
-
@itcarroll, I got an email notification that you replied to this discussion, but for some reason I don't see your reply on github itself, so I'm copying your reply from the email I received (forgive me if anybody sees a duplicate reply):
Yes, I would see this as an opportunity to combine/simplify/tidy-up the auth logic as well. There is at least 1 issue that is related, which I believe could be addressed by the use of a client/session object as well: #945 I believe this might help make it all a bit more clear/explicit, which might also help reduce confusion around it all. |
Beta Was this translation helpful? Give feedback.
-
I really like this idea, and I've suggested something similar in the results class discussion #847 (comment) so happy to see it gaining traction! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
There have been discussions in various issues about problems that might very well be solved by defining/exposing some sort of "client" or "session" object in the earthaccess API:
login
, not with things that can be done without having to login, such as just searching.At a minimum, I think we have these requirements:
requests
orboto3
, which make use of a default session instance, if no explicit session is created and used)What might this look like?
I imagine we could easily do something very similar to what other libraries do, such as
requests
andboto3
, where we would automatically create and use a default client/session object, which would be used automatically by the current top-level API functions.For users who want to override defaults, we would add a new top-level function for creating a customized client/session instance, and then call methods on the instance rather than calling functions from the top-level. The methods on the instance would be the same names as the top-level functions (and the top-level functions would be modified to simply call the corresponding methods on the default client/session instance).
For example (I'm using the name
Client
to avoid confusion withSession
, which bothrequests
andboto3
use, but of course, the class name is open to "voting", if there's agreement that this work should take place):Existing user code would not need to change, but if a user wants to configure/customize differently, they can do so:
Additionally, if a user wants to hit both UAT and PROD:
Beta Was this translation helpful? Give feedback.
All reactions