The ApproveAssignment operation approves the results of a completed assignment.
Approving an assignment initiates two payments from the Requester's Amazon.com account
If the Requester's account does not have adequate funds for these payments, the call to ApproveAssignment returns an exception, and the approval is not processed. You can include an optional feedback message with the approval, which the Worker can see in the Status section of the web site.
You can also call this operation for assignments that were previous rejected and approve them by explicitly overriding the previous rejection. This only works on rejected assignments that were submitted within the previous 30 days and only if the assignment's related HIT has not been deleted.
Parameters:
-
assignment_id
(EntityId)
–
The ID of the assignment. The assignment must correspond to a HIT created by the Requester.
-
requester_feedback
(Optional[String], default:
None
)
–
A message for the Worker, which the Worker can see in the Status section of the web site.
-
override_rejection
(Optional[Boolean], default:
None
)
–
A flag indicating that an assignment should be approved even if it was previously rejected. Defaults to False.
Raises:
Source code in docs_src/capo_mturk/_services/async_m_turk.py
| async def approve_assignment(
self,
assignment_id: "capo_mturk.types.entity_id.EntityId",
*,
config_overrides: Optional[AsyncMTurkClientConfig] = None,
requester_feedback: Optional["capo_mturk.types.string.String"] = None,
override_rejection: Optional["capo_mturk.types.boolean.Boolean"] = None,
) -> "capo_mturk.types.approve_assignment_response.ApproveAssignmentResponse":
"""<p> The <code>ApproveAssignment</code> operation approves the results of a completed assignment. </p> <p> Approving an assignment initiates two payments from the Requester's Amazon.com account </p> <ul> <li> <p> The Worker who submitted the results is paid the reward specified in the HIT. </p> </li> <li> <p> Amazon Mechanical Turk fees are debited. </p> </li> </ul> <p> If the Requester's account does not have adequate funds for these payments, the call to ApproveAssignment returns an exception, and the approval is not processed. You can include an optional feedback message with the approval, which the Worker can see in the Status section of the web site. </p> <p> You can also call this operation for assignments that were previous rejected and approve them by explicitly overriding the previous rejection. This only works on rejected assignments that were submitted within the previous 30 days and only if the assignment's related HIT has not been deleted. </p>
Args:
assignment_id: <p> The ID of the assignment. The assignment must correspond to a HIT created by the Requester. </p>
requester_feedback: <p> A message for the Worker, which the Worker can see in the Status section of the web site. </p>
override_rejection: <p> A flag indicating that an assignment should be approved even if it was previously rejected. Defaults to <code>False</code>. </p>
Raises:
capo_mturk.errors.request_error.RequestError: <p>Your request is invalid.</p>
capo_mturk.errors.service_fault.ServiceFault: <p>Amazon Mechanical Turk is temporarily unable to process your request. Try your call again.</p>
capo_mturk.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
async def _handler(
req: "AsyncOperationRequest[capo_mturk.types.approve_assignment_request.ApproveAssignmentRequest]",
) -> AsyncOperationResponse[
"capo_mturk.types.approve_assignment_response.ApproveAssignmentResponse"
]:
import capo_mturk._operations.m_turk_requester_service_v20170117.approve_assignment
(
output,
http_response,
) = await capo_mturk._operations.m_turk_requester_service_v20170117.approve_assignment.async_approve_assignment(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("ApproveAssignment")
)
input_: capo_mturk.types.approve_assignment_request.ApproveAssignmentRequest = {
"assignment_id": assignment_id
}
if requester_feedback is not None:
input_["requester_feedback"] = requester_feedback
if override_rejection is not None:
input_["override_rejection"] = override_rejection
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|