crowdlib_settings.py

Your crowdlib_settings.py file contains your AWS credentials, tells CrowdLib where to store its local data, and sets default parameters that will be use when you create HITs. It must be imported before you access any functions of CrowdLib. By simply importing it, it initializes your settings so that CrowdLib can find them. Put your crowdlib_settings.py somewhere Python can find it (i.e., in your project directory or elsewhere on your PYTHONPATH).

Important

Your crowdlib_settings.py contains your AWS credentials which must be kept secret. For example, someone could use it to post trivial HITs, do the HITs themselves, and then approve the HITs, effectively giving any money you have prepaid to Mechanical Turk. Never post your crowdlib_settings.py file publicly or leave it on a vulnerable web server.

You can find your AWS ID (“Access Key ID”) and secret key (“Secret Access Key”) here:

Your CrowdLib database file should probably be in a central location so that all of your CrowdLib projects can refer to it. The default (shown in the larger sample below) translates to $HOME/.crowdlib_data on UNIX/Mac or C:UsersYourUserName.crowdlib_dataon Windows.

Minimal crowdlib_settings file

from crowdlib import settings as cls
cls.service_type = "sandbox"
cls.aws_account_id  = "ABCDEFGHIJ0123456789"
cls.aws_account_key = "0123456789+abcdefghijklmn/ABCDEFGHIJKLMN"

Sample crowdlib_settings file

from crowdlib import settings as cls, os

# SERVICE TYPE
cls.service_type = "sandbox"  # REQUIRED; must be either "sandbox" or "production"

# AWS ACCOUNT INFO
cls.aws_account_id  = "ABCDEFGHIJ0123456789"                     # REQUIRED; "Access Key ID" from AWS
cls.aws_account_key = "0123456789+abcdefghijklmn/ABCDEFGHIJKL==" # REQUIRED; "Secret Access Key" from AWS

# DIRECTORY FOR CROWDLIB DATABASE
cls.db_dir = os.path.abspath(os.path.expanduser("~/.crowdlib_data/"))  # Optional; this is the default

# DEFAULT PARAMETERS used when creating HITs
cls.default_autopay_delay              = 60*60*48   # Optional; auto-pay after 48 hours; default is 7 days
cls.default_reward                     = 0.01       # Optional; no default (i.e., specify each time)
cls.default_lifetime                   = 60*60*24*7 # Optional; available up to 1 week (same as default)
cls.default_max_assignments            = 1          # Optional; 1 judgment (same as default)
cls.default_time_limit                 = 60*30      # Optional; auto-return after 30 mins (same as default)
cls.default_qualification_requirements = ()         # Optional; default is no qualification requirement
cls.default_requester_annotation       = ""         # Optional; default is no requester annotation
cls.default_keywords                   = ()         # Optional; default is no keywords