Nadia Mehjabin
Nadia Mehjabin

Reputation: 11

I am trying to create a hit using html file for amazon mturk

import boto3

#making client object

MTURK_SANDBOX = 'https://mturk-requester-sandbox.us-east-1.amazonaws.com'

mturk = boto3.client('mturk',
   aws_access_key_id = "AKIA3RTXAGOQVVBX3PWF",
   aws_secret_access_key = "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",
   region_name='us-east-1',
   endpoint_url = MTURK_SANDBOX
)
questionfile = open("/home/nm6088/mturk files/prac4_Jun27/index.html","r")
questions = questionfile .read()

localRequirements = [{
    'QualificationTypeId': '00000000000000000071',
    'Comparator': 'EqualTo',
    'LocaleValues': [{
     'Country': 'US'
   }],
   'RequiredToPreview': True
    }]    
    
hit = mturk.create_hit(
            
        Title='Write a simple version of the test',
        Description='A test HIT that requires the user to write a simple text.',
        Keywords='simple, qualification, test',
        Reward='0.01',
        MaxAssignments=1,
        LifetimeInSeconds=3600,
        AssignmentDurationInSeconds=600,
        AutoApprovalDelayInSeconds=200,
        Question = questions,
        QualificationRequirements=localRequirements
                                         )
 
print ("A new HIT has been created. You can preview it here:")
print ("https://workersandbox.mturk.com/mturk/preview?groupId=" + hit['HIT']['HITGroupId'])
print ("HITID = " + hit['HIT']['HITId'] + " (Use to Get Results)") 

botocore.exceptions.ClientError: An error occurred (ParameterValidationError) when calling the CreateHIT operation: There was an error parsing the XML question or answer data in your request. Please make sure the data is well-formed and validates against the appropriate schema. Details: cvc-elt.1.a: Cannot find the declaration of element 'HTMLQuestion'. (1656352060543 s)

Upvotes: 1

Views: 51

Answers (0)

Related Questions