# This script requires boto - a python interface to Amazon Web Services from boto.mturk.connection import MTurkConnection from boto.mturk.question import ExternalQuestion from boto.mturk.qualification import LocaleRequirement def create_hit(payment=.05, max_assignments=1, mode="sandbox"): # restrict MTurk workers to USA only USA_REQUIREMENT = LocaleRequirement('EqualTo', 'US', required_to_preview=True) url='http://yourwebpage.html' # adjust host setting, depending on whether HIT is live (production) or in testing mode (sandbox) if mode=="production": host='mechanicalturk.amazonaws.com' else: host='mechanicalturk.sandbox.amazonaws.com' # connect to mturk conn = MTurkConnection(aws_access_key_id='insert your aws access key here', aws_secret_access_key='insert your aws secret access key here', host=host) # create ExternalQuestion for MTurk Hit, use Hit's unique id as url q = ExternalQuestion(external_url=url, frame_height=800) # create hit on MTurk, store info in ResultSet object create_hit_rs = conn.create_hit(question=q, lifetime=60*6, max_assignments=max_assignments, keywords='facebook psychology entertainment games', reward=payment, duration=60*6, approval_delay=60*100, title='!Fun! Make the world more productive! Approx 4min!', description='Help us explore new ways to boost productivity. Approx 4min', qualifications=USA_REQUIREMENT, annotation='hit_type') assert(create_hit_rs.status == True)