Skip to content

get_account_balance

get_account_balance(
    *, config_overrides: Optional[MTurkClientConfig] = None
) -> GetAccountBalanceResponse

The GetAccountBalance operation retrieves the Prepaid HITs balance in your Amazon Mechanical Turk account if you are a Prepaid Requester. Alternatively, this operation will retrieve the remaining available AWS Billing usage if you have enabled AWS Billing. Note: If you have enabled AWS Billing and still have a remaining Prepaid HITs balance, this balance can be viewed on the My Account page in the Requester console.

Raises:

  • RequestError –

    Your request is invalid.

  • ServiceFault –

    Amazon Mechanical Turk is temporarily unable to process your request. Try your call again.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_mturk/_services/m_turk.py
def get_account_balance(
    self, *, config_overrides: Optional[MTurkClientConfig] = None
) -> "capo_mturk.types.get_account_balance_response.GetAccountBalanceResponse":
    """<p>The <code>GetAccountBalance</code> operation retrieves the Prepaid HITs balance in your Amazon Mechanical Turk account if you are a Prepaid Requester. Alternatively, this operation will retrieve the remaining available AWS Billing usage if you have enabled AWS Billing. Note: If you have enabled AWS Billing and still have a remaining Prepaid HITs balance, this balance can be viewed on the My Account page in the Requester console.</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.
    """

    def _handler(
        req: "OperationRequest[capo_mturk.types.get_account_balance_request.GetAccountBalanceRequest]",
    ) -> OperationResponse[
        "capo_mturk.types.get_account_balance_response.GetAccountBalanceResponse"
    ]:
        import capo_mturk._operations.m_turk_requester_service_v20170117.get_account_balance

        output, http_response = (
            capo_mturk._operations.m_turk_requester_service_v20170117.get_account_balance.get_account_balance(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("GetAccountBalance")
    )
    input_: capo_mturk.types.get_account_balance_request.GetAccountBalanceRequest = {}

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output