2022-11-05 14:45:53 +00:00
|
|
|
from typing import Generator
|
2020-02-14 13:51:36 +00:00
|
|
|
|
2022-12-13 16:14:13 +00:00
|
|
|
import urllib3
|
|
|
|
|
2020-02-14 13:51:36 +00:00
|
|
|
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
|
|
|
|
|
2017-10-13 22:35:18 +00:00
|
|
|
# Адрес для создания задачи
|
|
|
|
create_task_url = "https://api.anti-captcha.com/createTask"
|
|
|
|
# Адрес для получения ответа
|
|
|
|
get_result_url = "https://api.anti-captcha.com/getTaskResult"
|
|
|
|
# ключ приложения
|
2018-10-21 17:15:46 +00:00
|
|
|
app_key = "867"
|
2022-11-05 14:45:53 +00:00
|
|
|
|
|
|
|
|
|
|
|
# Connection retry generator
|
|
|
|
def attempts_generator(amount: int = 5) -> Generator:
|
|
|
|
"""
|
|
|
|
Function generates a generator of length equal to `amount`
|
|
|
|
|
|
|
|
Args:
|
|
|
|
amount: number of attempts generated
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
Attempt number
|
|
|
|
"""
|
|
|
|
for i in range(1, amount):
|
|
|
|
yield i
|