From 2585b97bdbafe0da2fd9b22c315cb40234988dae Mon Sep 17 00:00:00 2001 From: Andrei Date: Sat, 5 Nov 2022 17:45:53 +0300 Subject: [PATCH] Update config.py --- python3_anticaptcha/config.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/python3_anticaptcha/config.py b/python3_anticaptcha/config.py index da0b3f4..c2d839c 100644 --- a/python3_anticaptcha/config.py +++ b/python3_anticaptcha/config.py @@ -1,4 +1,5 @@ import urllib3 +from typing import Generator urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) @@ -8,3 +9,18 @@ create_task_url = "https://api.anti-captcha.com/createTask" get_result_url = "https://api.anti-captcha.com/getTaskResult" # ключ приложения app_key = "867" + + +# 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