commit
0636f2d6e2
|
@ -4,11 +4,8 @@ from .config import create_task_url, get_result_url, app_key, user_agent_data
|
|||
|
||||
|
||||
class NoCaptchaTask:
|
||||
"""
|
||||
TODO
|
||||
"""
|
||||
# Добавить прокси адрес
|
||||
def __init__(self, anticaptcha_key, website_url, website_key, proxy_type="http", proxy_adress="?",
|
||||
|
||||
def __init__(self, anticaptcha_key, website_url, website_key, proxy_type="http", proxy_adress=None,
|
||||
proxy_prot=None, proxy_password=None sleep_time=5, user_agent=user_agent_data, **kwargs):
|
||||
"""
|
||||
TODO
|
||||
|
@ -20,17 +17,19 @@ class NoCaptchaTask:
|
|||
self.website_url = website_url
|
||||
self.website_key = website_key
|
||||
self.proxy_type = proxy_type
|
||||
self.proxy_adress = proxy_adress
|
||||
self.proxy_login = proxy_login
|
||||
self.proxy_password = proxy_password
|
||||
|
||||
#TODO заполнить пайлоад для решения рекапчи
|
||||
self.task_payload = {"clientKey": self.ANTIKAPTCHA_KEY,
|
||||
"task":
|
||||
{
|
||||
"type": "NoCaptchaTask",
|
||||
"website_url": self.website_url,
|
||||
"website_key": self.website_key,
|
||||
"proxy_type": self.proxy_type,
|
||||
"proxy_adress": None,
|
||||
"proxy_login": None,
|
||||
"proxy_password": None
|
||||
"proxy_adress": self.proxy_adress,
|
||||
"proxy_login": self.proxy_login,
|
||||
"proxy_password": self.proxy_password
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -39,7 +38,9 @@ class NoCaptchaTask:
|
|||
self.task_payload['task'].update({key: kwargs[key]})
|
||||
|
||||
|
||||
def captcha_handler(self):
|
||||
def captcha_handler(self, websiteURL, websiteKey):
|
||||
self.task_payload['task'].update({"websiteURL": websiteURL,
|
||||
"websiteKey": websiteKey})
|
||||
# отправляем реквест
|
||||
captcha_id = requests.post(create_task_url, json=self.task_payload).json()
|
||||
|
||||
|
@ -49,6 +50,15 @@ class NoCaptchaTask:
|
|||
else:
|
||||
return captcha_id
|
||||
|
||||
# Ждем решения капчи
|
||||
time.sleep(self.sleep_time)
|
||||
while True:
|
||||
pass
|
||||
captcha_response = requests.post(get_result_url, json=self.result_payload)
|
||||
|
||||
if captcha_response.json()["errorId"] == 0:
|
||||
if captcha_response.json()["status"] == "processing":
|
||||
time.sleep(self.sleep_time)
|
||||
else:
|
||||
return captcha_response.json()
|
||||
else:
|
||||
return captcha_response.json()
|
Loading…
Reference in New Issue