Я пытаюсь отправить запрос, используя пример, приведенный в примере mturk
Вот мой вопрос. xml:
<?xml version="1.0" encoding="UTF-8"?>
<ExternalQuestion xmlns="http://mechanicalturk.amazonaws.com/AWSMechanicalTurkDataSchemas/2011-11-11/HTMLQuestion.xsd">
<ExternalURL>https://tictactoe.amazon.com/gamesurvey.cgi?gameid=01523</ExternalURL>
<FrameHeight>750</FrameHeight>
</ExternalQuestion>
и вот мой submit_hit.py:
import boto3
from dateutil.parser import *
MTURK_SANDBOX = 'https://mturk-requester-sandbox.us-east-1.amazonaws.com'
mturk = boto3.client('mturk',
aws_access_key_id = "....",
aws_secret_access_key = "....",
region_name='us-east-1',
endpoint_url = MTURK_SANDBOX
)
print "I have $" + mturk.get_account_balance()['AvailableBalance'] + " in my Sandbox account"
question = open(name='question.xml',mode='r').read()
new_hit = mturk.create_hit(
Title = 'Here comes the title',
Description = 'Here comes description'
Keywords = 'game, quick',
Reward = '0.15',
MaxAssignments = 1,
LifetimeInSeconds = 172800,
AssignmentDurationInSeconds = 600,
AutoApprovalDelayInSeconds = 14400,
Question = question,
)
print "A new HIT has been created. You can preview it here:"
print "https://workersandbox.mturk.com/mturk/preview?groupId=" + new_hit['HIT']['HITGroupId']
print "HITID = " + new_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: Cannot find the declaration of element 'ExternalQuestion'. (1579649552886 s)
Мне нужно использовать внешний URL-адрес (т.е. я не могу скопировать мой html файл в . xml), поскольку мой контент html представляет собой веб-инструмент, а не простой вопрос. Я использую python 2,7, если это имеет значение. Буду очень признателен за любую помощь.