async def test_fail_aioresult_handler(self): # prepare client custom_result = CustomResultHandler.aioCustomResultHandler( anticaptcha_key=self.anticaptcha_key_fail) response = await custom_result.task_handler(task_id=self.WRONG_TASK_ID) # check error code assert 1 == response["errorId"]
def test_fail_result_handler_context(self): # prepare client with CustomResultHandler.CustomResultHandler( anticaptcha_key=self.anticaptcha_key_fail) as custom_result: response = custom_result.task_handler(task_id=self.WRONG_TASK_ID) # check error code assert 1 == response["errorId"]
def test_true_result_handler(self): # prepare client custom_result = CustomResultHandler.CustomResultHandler( anticaptcha_key=self.anticaptcha_key_true) response = custom_result.task_handler(task_id=self.WRONG_TASK_ID) # check error code assert 16 == response["errorId"]
async def run(): try: # io.IOBase custom_result = CustomResultHandler.aioCustomResultHandler( anticaptcha_key=ANTICAPTCHA_KEY) response = await custom_result.task_handler(task_id=TASK_ID) print(response) except Exception as err: print(err)
async def test_true_aioresult_handler_context(self): # prepare client with CustomResultHandler.aioCustomResultHandler( anticaptcha_key=self.anticaptcha_key_true ) as custom_result: response = await custom_result.task_handler(task_id=self.WRONG_TASK_ID) # check error code assert 16 == response["errorId"]
async def test_response_aioresult_handler(self): # prepare client custom_result = CustomResultHandler.aioCustomResultHandler( anticaptcha_key=self.anticaptcha_key_true ) # check response type assert isinstance(custom_result, CustomResultHandler.aioCustomResultHandler) response = await custom_result.task_handler(task_id=self.WRONG_TASK_ID) # check response type assert isinstance(response, dict) # check all dict keys assert ["errorId", "errorCode", "errorDescription", "taskId"] == list(response.keys())
import asyncio from python3_anticaptcha import CustomResultHandler ANTICAPTCHA_KEY = "" """ This module is used to obtain the result of solving the task in "manual" mode """ TASK_ID = 123456 # prepare client custom_result = CustomResultHandler.CustomResultHandler( anticaptcha_key=ANTICAPTCHA_KEY) response = custom_result.task_handler(task_id=TASK_ID) print(response) # async example async def run(): try: # io.IOBase custom_result = CustomResultHandler.aioCustomResultHandler( anticaptcha_key=ANTICAPTCHA_KEY) response = await custom_result.task_handler(task_id=TASK_ID) print(response) except Exception as err: print(err) if __name__ == "__main__":