Add `taskId` to captcha_response body. Update version

This commit is contained in:
Andrei 2019-01-19 00:08:08 +03:00
parent af29b5ae19
commit 937c30e5d3
2 changed files with 10 additions and 6 deletions

View File

@ -16,15 +16,17 @@ def get_sync_result(result_payload: dict, sleep_time: int):
session.mount('https://', HTTPAdapter(max_retries = 5))
while True:
captcha_response = session.post(get_result_url, json=result_payload)
captcha_response = session.post(get_result_url, json=result_payload).json()
if captcha_response.json()["errorId"] == 0:
if captcha_response.json()["status"] == "processing":
if captcha_response["errorId"] == 0:
if captcha_response["status"] == "processing":
time.sleep(sleep_time)
else:
return captcha_response.json()
captcha_response.update({"taskId": result_payload['taskId']})
return captcha_response
else:
return captcha_response.json()
captcha_response.update({"taskId": result_payload['taskId']})
return captcha_response
async def get_async_result(result_payload: dict, sleep_time: int):
@ -40,6 +42,8 @@ async def get_async_result(result_payload: dict, sleep_time: int):
await asyncio.sleep(sleep_time)
# Иначе возвращаем ответ
else:
json_result.update({"taskId": result_payload['taskId']})
return json_result
else:
json_result.update({"taskId": result_payload['taskId']})
return json_result

View File

@ -2,7 +2,7 @@ from setuptools import setup
setup(
name = 'python3-anticaptcha',
version = '1.2',
version = '1.2.1',
author = 'AndreiDrang, redV0ID',
packages = ['python3_anticaptcha'],