Question

Are there any methods in the boto library that would allow me to answer my own HIT programmatically? This would be very useful for automated testing. From my reading of the boto docs it does not seem possible.

I would like to do something like this:

First, post HITs to the Turk. Nothing out of the ordinary here; a good example of using boto to publish to Turk can be found here.

# establish a connection to Mechanical Turk
mtc = MTurkConnection(aws_access_key_id = ACCESS_ID, aws_secret_access_key = SECRET_KEY, host = HOST)

# construct question forms (omitted for clarity; see tutorial above)

# publish the HIT to Mechanical Turk
mtc.create_hit(
    questions=question_form,
    max_assignments=1,
    title=title,
    description=description,
    keywords=keywords,
    duration = 60*5,
    reward=0.05
)

Here is what I don't know how to do. I want to answer my own HIT so that when I get the results, the answer fields will be populated. I know it can be done manually using the Worker Sandbox, but I want to incorporate this into unit tests, so it would be nice if it could be automated. I imagine it might look something like this:

answers = { 'question_1':'answer_1', 'question_2':'answer_2' }

mtc.answer_hit(hit_id=hit_id, answers=answers)

And finally, I want to get the results. This is pretty standard as well.

rs = mtc.get_reviewable_hits(page_size=100)

for hit in rs:
    assignments = mtc.get_assignments(hit.HITId)
    for answer in assignment.answers[0]:
        # process answers
Was it helpful?

Solution

Nope. There is no Worker API for MTurk, so it's not possible to do this programmatically. It has been requested various times on the developer forum, but there seems to be no activity from AWS about creating it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top