diff --git a/python3_anticaptcha/AntiCaptchaControl.py b/python3_anticaptcha/AntiCaptchaControl.py index 8611f91..61e0fa8 100644 --- a/python3_anticaptcha/AntiCaptchaControl.py +++ b/python3_anticaptcha/AntiCaptchaControl.py @@ -11,6 +11,14 @@ class AntiCaptchaControl: :param anticaptcha_key: Ключ антикапчи """ self.ANTICAPTCHA_KEY = anticaptcha_key + + def __enter__(self): + return self + + def __exit__(self, exc_type, exc_value, traceback): + if exc_type: + return False + return True def get_balance(self): ''' @@ -43,6 +51,14 @@ class aioAntiCaptchaControl: :param anticaptcha_key: Ключ антикапчи """ self.ANTICAPTCHA_KEY = anticaptcha_key + + def __enter__(self): + return self + + def __exit__(self, exc_type, exc_value, traceback): + if exc_type: + return False + return True async def get_balance(self): ''' @@ -64,4 +80,4 @@ class aioAntiCaptchaControl: } async with aiohttp.ClientSession() as session: async with session.post(incorrect_captcha_url, json=payload) as resp: - return await resp.json() \ No newline at end of file + return await resp.json()