Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Related to #29. Setting default region to us-east-1 #30

Merged
merged 1 commit into from
Jan 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ config.json
hit_templates_rendered/*
rendered_templates/*
config*.json
.idea/
.DS_STORE
11 changes: 9 additions & 2 deletions simpleamt.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,20 @@ def get_mturk_connection_from_args(args):
aws_secret_key=aws_secret_key)


def get_mturk_connection(sandbox=True, aws_access_key=None,
aws_secret_key=None):
def get_mturk_connection(sandbox=True,
aws_access_key=None,
aws_secret_key=None,
region_name='us-east-1'):
"""
Get a boto mturk connection. This is a thin wrapper over boto3.client;
the only difference is a boolean flag to indicate sandbox or not.
"""
kwargs = {}
# boto3 client requires a region to make a connection. if you
# have a default region in your ~/.aws/config other than us-east-1,
# it throws an error. Since Mturk endpoint is by default only in
# us-east-1, there is no point of asking users to provide it. See #29
kwargs['region_name'] = region_name
if aws_access_key is not None:
kwargs['aws_access_key_id'] = aws_access_key
if aws_secret_key is not None:
Expand Down