-
Notifications
You must be signed in to change notification settings - Fork 90
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
add us-west-2 check to API and improve auth repr #424
Draft
JessicaS11
wants to merge
17
commits into
main
Choose a base branch
from
aws-check
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
228972f
add auth_info property
JessicaS11 4b38af7
update function lists
JessicaS11 967794d
add in_us_west_2 check to API
JessicaS11 032880d
switch to repr for auth
JessicaS11 467689c
return string instead of boolean
JessicaS11 1a32eff
run linter
JessicaS11 0b88005
replace us-west-2 check with boto3 functionality
JessicaS11 7c5e027
change api to error
JessicaS11 f9115fa
Change boto3 region check to use botocore
battistowx c4135d7
use double quotes for ruff
JessicaS11 45e2ea1
fix more formatting
JessicaS11 b1a1f27
add newline
JessicaS11 d0a25d7
remove tab
JessicaS11 4c8837d
remove more tabs
JessicaS11 5a28e74
remove more tabs
JessicaS11 aaf884d
update docstring
JessicaS11 ca7e907
Merge branch 'main' into aws-check
JessicaS11 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -76,6 +76,28 @@ def __init__(self) -> None: | |
self.EDL_GENERATE_TOKENS_URL = "https://urs.earthdata.nasa.gov/api/users/token" | ||
self.EDL_REVOKE_TOKEN = "https://urs.earthdata.nasa.gov/api/users/revoke_token" | ||
|
||
def __repr__(self) -> str: | ||
print_str = "Authentication Info\n" + "-------------------\n" | ||
for k, v in self.auth_info.items(): | ||
print_str += str("{}: {}\n".format(k, v)) | ||
|
||
return print_str | ||
Comment on lines
+79
to
+84
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I strongly discourage this implementation of
|
||
|
||
@property | ||
def auth_info(self) -> Dict: | ||
"""Get information about the authentication session | ||
|
||
Returns: | ||
Dict: information about the auth object | ||
""" | ||
summary_dict: Dict[str, Any] | ||
summary_dict = { | ||
"authenticated?": self.authenticated, | ||
"tokens": self.tokens, | ||
} | ||
|
||
return summary_dict | ||
|
||
def login(self, strategy: str = "netrc", persist: bool = False) -> Any: | ||
"""Authenticate with Earthdata login. | ||
|
||
|
@@ -168,6 +190,7 @@ def get_s3_credentials( | |
provider: A valid cloud provider. Each DAAC has a provider code for their cloud distributions. | ||
endpoint: Getting the credentials directly from the S3Credentials URL. | ||
|
||
|
||
Returns: | ||
A Python dictionary with the temporary AWS S3 credentials. | ||
""" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Warning: these strings will concatenate :)