I use the Python AWS boto v2.7 package to interact with the Mturk API to create and manage HIT, etc.
I am trying to create a HIT using an existing template. Amazon's documentation on this topic is here: http://docs.aws.amazon.com/AWSMechTurk/2012-03-25/AWSMturkAPI/ApiReference_CreateHITOperation.html
My code is:
from boto.mturk.connection import MTurkConnection
mtc = MTurkConnection(aws_access_key_id=ACCESS_ID,
aws_secret_access_key=SECRET_KEY,
host=HOST)
mtc.create_hit(hit_layout=HIT_LAYOUT_ID)
Error:
MTurkRequestError: MTurkRequestError: 200 OK
<?xml version="1.0"?>
<CreateHITResponse><OperationRequest><RequestId>986926dd-0263-4aca-970c-139b7ed4a0e8</RequestId></OperationRequest><HIT><Request><IsValid>False</IsValid><Errors><Error><Code>AWS.MechanicalTurk.InvalidParameterValue</Code><Message>There was an error parsing the request (1359492767224 s)</Message></Error></Errors></Request></HIT></CreateHITResponse>
It looks like the MTurk API is expecting a layout parameter, as described here: http://docs.aws.amazon.com/AWSMechTurk/2012-03-25/AWSMturkAPI/ApiReference_HITLayoutArticle.html
While my original template used placeholder values, I deleted them for simplicity and just tried to get the code to work. In this case, I would have thought that the only required parameter would be hit_layout?
boto api - ?
mturkcore, , .
:
import mturkcore
login_dict = {'use_sandbox':True,
'stdout_log':False,
'AWS_ACCESS_KEY_ID':'ACCESS_ID',
'AWS_SECRET_ACCESS_KEY':'PASSWORD'}
mtc = mturkcore.MechanicalTurk(login_dict)
request_params = {"Title":"Test Layout",
"Description":"Test Description",
"HITLayoutId":"2QNNJKM05BMJLZIA6G7TS9RA7TECHE",
"Reward":0.05,
"LifetimeInSeconds":6000,
"AssignmentDurationInSeconds":600
}
mtc.create_request("CreateHIT", request_params)
msg suds:
TypeNotFound: Type not found: 'HITLayoutId'
, : http://docs.aws.amazon.com/AWSMechTurk/latest/AWSMturkAPI/ApiReference_CreateHITOperation.html, .
, HIT , . -, , , , . - , , !
, , Reward, LifetimeInSeconds AssignmentDurationInSeconds , . , HIT, "Manage HITs Individually".