Skip to content

Commit

Permalink
SDK-354 Default to S3 Signature Version V4 (#273)
Browse files Browse the repository at this point in the history
Signature Version V2 will be deprecated by AWS which was the default for boto, configured it to use v4 signature for s3 authentication.
  • Loading branch information
chattarajoy committed May 21, 2019
1 parent 6951fe2 commit f8e3548
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions qds_sdk/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,19 +299,17 @@ def get_results(self, fp=sys.stdout, inline=True, delim=None, fetch=True, qlog=N
pass
else:
if fetch:
if not boto.config.has_section('s3'):
boto.config.add_section('s3')
boto.config.set('s3', 'use-sigv4', 'True')
storage_credentials = conn.get(Account.credentials_rest_entity_path)
if storage_credentials['region_endpoint'] is not None:
boto_conn = boto.connect_s3(aws_access_key_id=storage_credentials['storage_access_key'],
aws_secret_access_key=storage_credentials['storage_secret_key'],
security_token = storage_credentials['session_token'],
host = storage_credentials['region_endpoint'])
else:
boto_conn = boto.connect_s3(aws_access_key_id=storage_credentials['storage_access_key'],
aws_secret_access_key=storage_credentials['storage_secret_key'],
security_token=storage_credentials['session_token'])

host = storage_credentials['region_endpoint'] if storage_credentials['region_endpoint'] else "s3.amazonaws.com"
boto_conn = boto.connect_s3(aws_access_key_id=storage_credentials['storage_access_key'],
aws_secret_access_key=storage_credentials['storage_secret_key'],
security_token=storage_credentials['session_token'],
host=host)
log.info("Starting download from result locations: [%s]" % ",".join(r['result_location']))
#fetch latest value of num_result_dir
# fetch latest value of num_result_dir
num_result_dir = Command.find(self.id).num_result_dir

# If column/header names are not able to fetch then use include header as true
Expand Down

0 comments on commit f8e3548

Please sign in to comment.