Skip to content

Commit

Permalink
Fixes #1201 - Raise an explicit error when only env var AWS_ACCESS_KE…
Browse files Browse the repository at this point in the history
…Y is set
  • Loading branch information
fviard committed Sep 27, 2021
1 parent 0e9044b commit 3017dfc
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions S3/Config.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,11 @@ def __init__(self, configfile = None, access_key=None, secret_key=None, access_t
env_secret_key = os.getenv('AWS_SECRET_KEY') or os.getenv('AWS_SECRET_ACCESS_KEY')
env_access_token = os.getenv('AWS_SESSION_TOKEN') or os.getenv('AWS_SECURITY_TOKEN')
if env_access_key:
if not env_secret_key:
raise ValueError(
"AWS_ACCESS_KEY environment variable is used but"
" AWS_SECRET_KEY variable is missing"
)
# py3 getenv returns unicode and py2 returns bytes.
self.access_key = base_unicodise(env_access_key)
self.secret_key = base_unicodise(env_secret_key)
Expand Down

0 comments on commit 3017dfc

Please sign in to comment.