Skip to content

Commit

Permalink
Fixes s3tools#987 - Fixes using IAM with python3. Config options shou…
Browse files Browse the repository at this point in the history
…ld be unicode.
  • Loading branch information
fviard committed Jul 18, 2018
1 parent b549182 commit 5d280cb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions S3/Config.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,10 +263,10 @@ def role_config(self):
conn.request('GET', "/latest/meta-data/iam/security-credentials/%s"%files.decode('UTF-8'))
resp=conn.getresponse()
if resp.status == 200:
creds=json.load(resp)
Config().update_option('access_key', creds['AccessKeyId'].encode('ascii'))
Config().update_option('secret_key', creds['SecretAccessKey'].encode('ascii'))
Config().update_option('access_token', creds['Token'].encode('ascii'))
creds=json.load(resp, encoding="utf-8")
Config().update_option('access_key', config_unicodise(creds['AccessKeyId']))
Config().update_option('secret_key', config_unicodise(creds['SecretAccessKey']))
Config().update_option('access_token', config_unicodise(creds['Token']))
else:
raise IOError
else:
Expand Down

0 comments on commit 5d280cb

Please sign in to comment.