Skip to content

Commit

Permalink
Merge 5a69418 into 93f488f
Browse files Browse the repository at this point in the history
  • Loading branch information
deargle committed May 3, 2021
2 parents 93f488f + 5a69418 commit 2cf285f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
8 changes: 7 additions & 1 deletion psiturk/amt_services.py
Expand Up @@ -268,6 +268,12 @@ def setup_mturk_connection(self):
kwargs['aws_secret_access_key'] = aws_secret_access_key

self.mtc = boto3.client('mturk', **kwargs)

# aws access key might have been set via env var -- fetch it and
# set it to the psiturk config for dashboard use
self.config.set('AWS Access', 'aws_access_key_id',
boto3.DEFAULT_SESSION.get_credentials().access_key)

return True

def verify_aws_login(self):
Expand Down Expand Up @@ -325,7 +331,7 @@ def configure_hit(self, hit_config):
for qual_id in hit_config['block_qualification_ids']:
quals.append(dict(QualificationTypeId=qual_id,
Comparator='DoesNotExist'))

for advanced_qual in hit_config['advanced_qualifications']:
quals.append(dict(advanced_qual))

Expand Down
7 changes: 6 additions & 1 deletion psiturk/psiturk_config.py
Expand Up @@ -71,7 +71,12 @@ def load_config(self):
self.set(bc['in_section'], bc['prefer_this'], os.environ.get(env_key))

# prefer environment
these_as_they_are = ['PORT', 'DATABASE_URL'] # heroku sets these
these_as_they_are = [
'PORT',
'DATABASE_URL',
'AWS_ACCESS_KEY_ID',
'AWS_SECRET_ACCESS_KEY'
]
for section in self.sections():
for config_var in self[section]:
config_var_upper = config_var.upper()
Expand Down

0 comments on commit 2cf285f

Please sign in to comment.