Skip to content

Commit

Permalink
Simplify pulling credential parts from AWS CLI JSON response body
Browse files Browse the repository at this point in the history
  • Loading branch information
magnetikonline committed Jan 25, 2023
1 parent 1f9969b commit 5b0a176
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,7 @@ def aws_sts_assume_role(

# pull out generated session credentials
def credential_part(key: str) -> str:
if "Credentials" not in assume_data:
return ""

return assume_data["Credentials"].get(key, "")
return assume_data.get("Credentials", {}).get(key, "")

access_key_id = credential_part("AccessKeyId")
secret_access_key = credential_part("SecretAccessKey")
Expand Down

0 comments on commit 5b0a176

Please sign in to comment.