This commit is contained in:
Andrei 2019-09-11 04:09:56 +03:00
parent 4d2a3d13ba
commit 5705f940d0
2 changed files with 12 additions and 14 deletions

View File

@ -10,9 +10,7 @@ This module is used to obtain the result of solving the task in "manual" mode
TASK_ID = 123456 TASK_ID = 123456
# prepare client # prepare client
custom_result = CustomResultHandler.CustomResultHandler( custom_result = CustomResultHandler.CustomResultHandler(anticaptcha_key=ANTICAPTCHA_KEY)
anticaptcha_key=ANTICAPTCHA_KEY
)
response = custom_result.task_handler(task_id=TASK_ID) response = custom_result.task_handler(task_id=TASK_ID)
print(response) print(response)
@ -34,4 +32,4 @@ async def run():
if __name__ == "__main__": if __name__ == "__main__":
loop = asyncio.get_event_loop() loop = asyncio.get_event_loop()
loop.run_until_complete(run()) loop.run_until_complete(run())
loop.close() loop.close()

View File

@ -48,7 +48,7 @@ class TestAntiCaptcha(MainAntiCaptcha):
) )
# check response type # check response type
assert isinstance(custom_result, CustomResultHandler.CustomResultHandler) assert isinstance(custom_result, CustomResultHandler.CustomResultHandler)
# get balance
response = custom_result.task_handler(task_id=self.WRONG_TASK_ID) response = custom_result.task_handler(task_id=self.WRONG_TASK_ID)
# check response type # check response type
assert isinstance(response, dict) assert isinstance(response, dict)
@ -65,7 +65,7 @@ class TestAntiCaptcha(MainAntiCaptcha):
) )
# check response type # check response type
assert isinstance(custom_result, CustomResultHandler.aioCustomResultHandler) assert isinstance(custom_result, CustomResultHandler.aioCustomResultHandler)
# get balance
response = await custom_result.task_handler(task_id=self.WRONG_TASK_ID) response = await custom_result.task_handler(task_id=self.WRONG_TASK_ID)
# check response type # check response type
assert isinstance(response, dict) assert isinstance(response, dict)
@ -83,7 +83,7 @@ class TestAntiCaptcha(MainAntiCaptcha):
custom_result = CustomResultHandler.CustomResultHandler( custom_result = CustomResultHandler.CustomResultHandler(
anticaptcha_key=self.anticaptcha_key_fail anticaptcha_key=self.anticaptcha_key_fail
) )
# get balance
response = custom_result.task_handler(task_id=self.WRONG_TASK_ID) response = custom_result.task_handler(task_id=self.WRONG_TASK_ID)
# check error code # check error code
assert 1 == response["errorId"] assert 1 == response["errorId"]
@ -93,7 +93,7 @@ class TestAntiCaptcha(MainAntiCaptcha):
with CustomResultHandler.CustomResultHandler( with CustomResultHandler.CustomResultHandler(
anticaptcha_key=self.anticaptcha_key_fail anticaptcha_key=self.anticaptcha_key_fail
) as custom_result: ) as custom_result:
# get balance
response = custom_result.task_handler(task_id=self.WRONG_TASK_ID) response = custom_result.task_handler(task_id=self.WRONG_TASK_ID)
# check error code # check error code
assert 1 == response["errorId"] assert 1 == response["errorId"]
@ -104,7 +104,7 @@ class TestAntiCaptcha(MainAntiCaptcha):
custom_result = CustomResultHandler.aioCustomResultHandler( custom_result = CustomResultHandler.aioCustomResultHandler(
anticaptcha_key=self.anticaptcha_key_fail anticaptcha_key=self.anticaptcha_key_fail
) )
# get balance
response = await custom_result.task_handler(task_id=self.WRONG_TASK_ID) response = await custom_result.task_handler(task_id=self.WRONG_TASK_ID)
# check error code # check error code
assert 1 == response["errorId"] assert 1 == response["errorId"]
@ -115,7 +115,7 @@ class TestAntiCaptcha(MainAntiCaptcha):
with CustomResultHandler.aioCustomResultHandler( with CustomResultHandler.aioCustomResultHandler(
anticaptcha_key=self.anticaptcha_key_fail anticaptcha_key=self.anticaptcha_key_fail
) as custom_result: ) as custom_result:
# get balance
response = await custom_result.task_handler(task_id=self.WRONG_TASK_ID) response = await custom_result.task_handler(task_id=self.WRONG_TASK_ID)
# check error code # check error code
assert 1 == response["errorId"] assert 1 == response["errorId"]
@ -129,7 +129,7 @@ class TestAntiCaptcha(MainAntiCaptcha):
custom_result = CustomResultHandler.CustomResultHandler( custom_result = CustomResultHandler.CustomResultHandler(
anticaptcha_key=self.anticaptcha_key_true anticaptcha_key=self.anticaptcha_key_true
) )
# get balance
response = custom_result.task_handler(task_id=self.WRONG_TASK_ID) response = custom_result.task_handler(task_id=self.WRONG_TASK_ID)
# check error code # check error code
assert 16 == response["errorId"] assert 16 == response["errorId"]
@ -139,7 +139,7 @@ class TestAntiCaptcha(MainAntiCaptcha):
with CustomResultHandler.CustomResultHandler( with CustomResultHandler.CustomResultHandler(
anticaptcha_key=self.anticaptcha_key_true anticaptcha_key=self.anticaptcha_key_true
) as custom_result: ) as custom_result:
# get balance
response = custom_result.task_handler(task_id=self.WRONG_TASK_ID) response = custom_result.task_handler(task_id=self.WRONG_TASK_ID)
# check error code # check error code
assert 16 == response["errorId"] assert 16 == response["errorId"]
@ -150,7 +150,7 @@ class TestAntiCaptcha(MainAntiCaptcha):
custom_result = CustomResultHandler.aioCustomResultHandler( custom_result = CustomResultHandler.aioCustomResultHandler(
anticaptcha_key=self.anticaptcha_key_true anticaptcha_key=self.anticaptcha_key_true
) )
# get balance
response = await custom_result.task_handler(task_id=self.WRONG_TASK_ID) response = await custom_result.task_handler(task_id=self.WRONG_TASK_ID)
# check error code # check error code
assert 16 == response["errorId"] assert 16 == response["errorId"]
@ -161,7 +161,7 @@ class TestAntiCaptcha(MainAntiCaptcha):
with CustomResultHandler.aioCustomResultHandler( with CustomResultHandler.aioCustomResultHandler(
anticaptcha_key=self.anticaptcha_key_true anticaptcha_key=self.anticaptcha_key_true
) as custom_result: ) as custom_result:
# get balance
response = await custom_result.task_handler(task_id=self.WRONG_TASK_ID) response = await custom_result.task_handler(task_id=self.WRONG_TASK_ID)
# check error code # check error code
assert 16 == response["errorId"] assert 16 == response["errorId"]